SpectraB+ 86/100

SPECTRA

> analyzing anthropic-sdk-python
the full spectrum of your codebase
Architecture 81 B
Security 90 A
Quality 85 B+
Documentation 76 C+
Maintainability 85 B+
Performance 92 A
Your codebase scores B+ (86/100) — strong performance with documentation gaps

Top Strengths

Performance A (92)
Security A (91)
Maintainability B+ (86)

Key Concerns

Documentation C+ (76)
Architecture B (81)
Quality B+ (86)
Severity Distribution
medium (16) low (20) info (14)
50 findings · 6 agents · 248s · ~88h tech debt
  1. 01> medium Massive duplication between APIResponse and LegacyAPIResponse src/anthropic/_legacy_response.py:188

    Extract a shared `_parse_to_python(response, cast_to, *, is_stream, stream_cls, client, options)` free function and call it from both LegacyAPIResponse._parse and BaseAPIResponse._parse. Keep the public surfaces (sync vs async parse(), property-vs-method) divergent but eliminate the duplicated type-dispatch ladder.

  2. 02> medium Sync/async request loop duplicated nearly verbatim in BaseClient subclasses src/anthropic/_base_client.py:877

    Factor the retry/error-handling pipeline into a generic helper that takes `send`/`sleep`/`close_response` callables (one sync set, one async set). Alternatively, push the loop body into pure functions that operate on already-resolved `httpx.Response` and let each subclass handle only the I/O verbs. This would reduce maintenance risk and ensure parity.

  3. 03> medium SSE event-name dispatch is a hand-maintained string ladder duplicated sync/async src/anthropic/_streaming.py:96

    Define a module-level `_KNOWN_EVENT_TYPES: frozenset[str]` (or a small dispatch table) shared by both Stream and AsyncStream. The dispatch loop becomes `if sse.event in _KNOWN_EVENT_TYPES:` and the two stream implementations stay structurally identical. Better still, drive event handling from a generated registry tied to the OpenAPI spec.

  4. 04> medium Public package __init__ imports from lib/* unconditionally, coupling generated client to hand-written extensions src/anthropic/__init__.py:89

    Use the existing `_resources_proxy`-style lazy attribute pattern for optional provider clients, or guard imports with `try/except ImportError` and only re-export when the optional extras are installed. This preserves the layering: generated core has zero runtime dependency on hand-written lib/, and provider variants pay-for-what-you-use.

  5. 05> medium BaseClient leaks subclass concerns: hard-coded model token table and Anthropic-specific timeout calc src/anthropic/_base_client.py:570

    Move `_calculate_nonstreaming_timeout` and the model-token table into the messages resource (resources/messages/messages.py) where the streaming/non-streaming policy lives. The base client should expose only generic `Timeout` helpers; product policy belongs at the resource layer.

B+ 0 / 100
Industry median: 68 · Well above industry median for Python projects B grades represent well-maintained codebases with room for improvement
Architecture81
Security91
Quality86
Documentation76
Maintainability86
Performance92
Architecture
0 B
Security
0 A
Quality
0 B+
Documentation
0 C+
Maintainability
0 B+
Performance
0 A
0
Findings
0
Critical
0
Duration
$0
Cost
0
Agents
6
Agents
673K
Tokens Used
4m 7s
Duration
$7.41
API Cost
0
Hallucinations Removed
Agents Used
Architecture Security Quality Documentation Dependency Performance
Filter

CritiqueAgent validated findings using extended thinking. 4 of 50 findings were individually confirmed.

Architecture (9)

estimated effort: ~33h

Security (9)

estimated effort: ~14h

Quality (5)

estimated effort: ~9h

Documentation (14)

estimated effort: ~16h

Maintainability (9)

estimated effort: ~14h

Performance (1)

estimated effort: ~1h

Patterns identified by CritiqueAgent that span multiple dimensions

arch-003, qual-001, and doc-009 all describe the same SSE event-list duplication — a single refactor (extract module-level frozenset + document in helpers.md) resolves architecture, quality, and documentation findings simultaneously.
arch-001, arch-007, and qual-000 collectively describe the sync/async duplication tax. Since the SDK is Stainless-generated, these are upstream-template concerns and should be batched into a single ADR/upstream issue rather than addressed in this repo.
qual-005 and dep-007 are duplicate findings about the ruff target-version/requires-python mismatch. Should be deduplicated — single trivial fix.
sec-000, sec-001, and sec-005 share a redaction theme (logs, debug dumps, repr). A single SecretStr-style helper plus a redacting log filter would close all three.
doc-004 is partially a code-correctness issue: the unreachable 503/504 mapping in _make_status_error makes the documented error classes inaccessible — fixing the mapping resolves both the doc and a latent quality bug.
arch-005 (model-specific logic in BaseClient) and doc-007 (undocumented MODEL_NONSTREAMING_TOKENS) both stem from product policy living at the wrong layer; relocating to resources/messages addresses both.
0 estimated hours to remediate
cost to remediate: ~$15,356 at $150/hr avg dev rate
By Dimension
Architecture 33.0h
Documentation 16.5h
Security 14.5h
Maintainability 13.5h
Quality 9.2h
Performance 1.0h
By Severity
medium 51.0h
low 26.8h
info 10.0h
Debt Distribution
medi
low
info
OWASP Top 10 (2021) Coverage
1 of 10 categories checked
A01:2021 Broken Access Control
A02:2021 Cryptographic Failures
A03:2021 Injection
A04:2021 Insecure Design
A05:2021 Security Misconfiguration
A06:2021 Vulnerable and Outdated Components
A07:2021 Identification and Auth Failures
A08:2021 Software and Data Integrity Failures
A09:2021 Security Logging and Monitoring Failures
A10:2021 Server-Side Request Forgery
OWASP Top 10 (2025) Coverage
1 of 10 categories checked
A01:2025 Broken Access Control
A02:2025 Security Misconfiguration
A03:2025 Software Supply Chain Failures
A04:2025 Cryptographic Failures
A05:2025 Injection
A06:2025 Insecure Design
A07:2025 Authentication Failures
A08:2025 Software or Data Integrity Failures
A09:2025 Logging and Alerting Failures
A10:2025 Mishandling of Exceptional Conditions
CWE References Found
CWE-15 CWE-200 CWE-295 CWE-312 CWE-441 CWE-532 CWE-601 CWE-755 CWE-757 CWE-918

AI-assisted screening based on finding text. Not a substitute for professional penetration testing.

Automated heuristic — not a substitute for formal due diligence or financial advisory. Score is derived from code-quality signals, not business fundamentals.
0 / 100
needs work

Moderate technical risk. Several areas need attention before fundraising.

Component Breakdown
Overall Score
86 25%
Security Posture
91 20%
Issue Concentration
48 10%
Dependency Health
0 10%
Code Complexity
50 10%
License Compliance
95 10%
SOC 2 Readiness
46 10%
Critical Findings
100 5%

AI-estimated composite score. Consult qualified advisors for investment decisions.

Automated heuristic — not a substitute for formal SOC 2 assessment. Findings are mapped by keyword analysis, not control evidence evaluation.
45.5% control coverage
15 of 33 controls addressed
18 gaps · 33 findings mapped
CC1: Control Environment 1/5
CC1.1 Integrity and ethical values
CC1.2 Board independence and oversight
CC1.3 Management structure and reporting 1
CC1.4 Commitment to competence
CC1.5 Accountability for internal controls
CC2: Communication and Information 2/3
CC2.1 Information for internal control 6
CC2.2 Internal communication of objectives 1
CC2.3 External communication
CC3: Risk Assessment 3/4
CC3.1 Specification of suitable objectives 1
CC3.2 Risk identification and analysis 1
CC3.3 Consideration of fraud risk
CC3.4 Identification of significant changes 1
CC4: Monitoring Activities 0/2
CC4.1 Ongoing and separate evaluations
CC4.2 Communication of deficiencies
CC5: Control Activities 1/3
CC5.1 Selection of control activities
CC5.2 Technology general controls
CC5.3 Deployment through policies 2
CC6: Logical and Physical Access Controls 6/8
CC6.1 Logical access security software 2
CC6.2 Credential and secret management 7
CC6.3 Role-based access authorization 1
CC6.4 Access removal and session management 1
CC6.5 Physical access restrictions
CC6.6 System boundary protection 1
CC6.7 Data transmission security 3
CC6.8 Prevention of unauthorized software
CC7: System Operations 1/5
CC7.1 Infrastructure and availability monitoring
CC7.2 Security event detection 1
CC7.3 Security event evaluation
CC7.4 Incident response procedures
CC7.5 Recovery and resilience
CC8: Change Management 0/1
CC8.1 Change control processes
CC9: Risk Mitigation 1/2
CC9.1 Risk mitigation for business disruptions
CC9.2 Third-party and vendor risk management 7

Keyword-based mapping to AICPA Common Criteria (CC1–CC9). Not a formal SOC 2 audit.

Automated heuristic — not a substitute for formal PCI DSS assessment. Findings are mapped by keyword analysis, not control evidence evaluation.
54.5% control coverage
6 of 11 controls addressed
5 gaps · 10 findings mapped
R6.2: Secure Software Development 1/4
6.2.1 Secure development processes defined
6.2.2 Software development personnel trained
6.2.3 Code reviewed before release
6.2.4 Protection against common vulnerabilities 1
R6.3: Security Vulnerabilities Identified and Addressed 3/3
6.3.1 Known vulnerabilities identified 4
6.3.2 Software inventory maintained 3
6.3.3 Patches applied timely 1
R6.4: Public-Facing Web Applications Protected 1/2
6.4.1 Web application firewall or equivalent
6.4.2 Automated attack detection 1
R6.5: Changes Managed Securely 1/2
6.5.1 Change control procedures
6.5.2 Development/test/production separation 1

Keyword-based mapping to PCI DSS 4.0 Requirement 6 (Secure Systems & Software). Not a formal PCI assessment.

Automated heuristic — not a substitute for formal NIST CSF assessment. Findings are mapped by keyword analysis, not control evidence evaluation.
50.0% function coverage
6 of 12 categories addressed
6 gaps · 20 findings mapped
GV: Govern 0/2
GV.OC-01 Organizational context understood
GV.RM-01 Risk management objectives established
ID: Identify 2/2
ID.AM-01 Asset inventory maintained 5
ID.RA-01 Risk assessment performed 4
PR: Protect 3/3
PR.AA-01 Access control enforced 2
PR.DS-01 Data security ensured 7
PR.PS-01 Platform security maintained 2
DE: Detect 1/2
DE.CM-01 Continuous monitoring implemented 2
DE.AE-01 Adverse event analysis performed
RS: Respond 0/2
RS.AN-01 Incident analysis conducted
RS.MI-01 Incident mitigation applied
RC: Recover 0/1
RC.RP-01 Recovery execution planned and tested

Keyword-based mapping to NIST Cybersecurity Framework 2.0 (6 Functions). Not a formal NIST assessment.

0
distribution score
concerning
0.517
Gini Coefficient
15
Unique Files
50
Total Issues
Top 10 Hotspot Files

Measures finding distribution across files. For contributor-based bus factor analysis, use git blame tools.

0 risk
critical risk
10 dependency findings analyzed · +10 severity penalty
Risk Signals Detected
2 unique licenses detected · 13 total mentions
MIT×10 ISC×3
1 file flagged for complexity by specialists. No numeric complexity scores were extracted from finding text.
Files flagged for complexity by specialists
This analysis cost
$7.41
Manual equivalent ($175/hr × 7h)
$1225
Spectra saved you
$1218 (99%)
Cost per finding
$0.15

Based on $175/hr senior engineer rate and ~7 hours for equivalent manual review. Actual costs vary.