Skip to content

Add comprehensive reference documentation for SPAC, extraction, identity, fetch, and eval - #328

Merged
sroussey merged 2 commits into
mainfrom
claude/audit-claude-md-files-q4672a
Aug 24, 2026
Merged

Add comprehensive reference documentation for SPAC, extraction, identity, fetch, and eval#328
sroussey merged 2 commits into
mainfrom
claude/audit-claude-md-files-q4672a

Conversation

@sroussey

Copy link
Copy Markdown
Contributor

Summary

This PR adds five new reference documentation files covering major subsystems of the SEC CLI tool. These docs provide detailed technical references for developers working with the codebase, complementing the existing CLAUDE.md project conventions guide.

Changes

  • docs/spac.md (678 lines): Complete reference for the SPAC lifecycle model, including:

    • The derived spac consolidated report and its append-only source tables (spac_deal, spac_event)
    • IPO processing and duplicate-prevention gates
    • De-SPAC milestones mapped from 8-K item codes
    • Deregistration vs unit separation (Form 25/25-NSE/Form 15)
    • Recovery procedures for databases that ingested follow-ons before gates were in place
  • docs/extraction.md (594 lines): Reference for the AI extraction pipeline:

    • Model configuration system with per-extractor overrides and confidence floors
    • Model ID shapes and provider dispatch (local, HuggingFace, OpenRouter, Anthropic, OpenAI, Google Gemini, xAI, DeepSeek)
    • Provider registration and error handling
    • OpenAI reasoning families and temperature coupling
    • DeepSeek JSON-mode limitations and validation
    • Document segmentation strategies for different form types
    • Per-extractor sections (S-1, 424, merger proxies, redemptions, LOI)
  • docs/identity.md (420 lines): Reference for observation, resolution, and identity linking:

    • Four-tier architecture (Observation → Canonical → Identity Link → Junction)
    • EntityObserver entry point and resolver dispatch
    • Person titles and dated roles with tenure tracking
    • Company identity resolution (CIK → CRD → normalized-name cascade)
    • Sponsor-family and underwriter-family resolvers
    • Alias resolution and merger handling
  • docs/fetch-and-storage.md (397 lines): Reference for the fetch layer and database setup:

    • SecCachedFetchTask and response_type handling
    • SecFetchFileOutputCache and cache miss detection
    • Retry queue mechanics (no in-job retry loop)
    • Bulk downloads (Feed tarballs and archives) as task-framework subgraphs
    • Database setup and reset procedures
  • docs/eval.md (341 lines): Reference for model comparison harnesses:

    • sec eval extract for comparing models on correctness, speed, and cost
    • sec eval s1 for S-1 section extraction evaluation
    • sec eval unit-terms for offering terms evaluation
    • Fixture registration and default model sets
    • Reading and interpreting evaluation results
  • CLAUDE.md (modified): Reduced from 3005 to 252 lines by moving detailed subsystem documentation to dedicated reference files while retaining project overview, command reference, and key architectural notes.

Implementation Details

These docs are extracted from detailed inline comments and design specs in the codebase and the PRD repository. They serve as the authoritative reference for:

  • How each subsystem works and why design decisions were made
  • Configuration options and their effects
  • Common failure modes and recovery procedures
  • Extension points and integration seams

The docs are structured to be both readable as a narrative and scannable as a reference, with tables, code examples, and cross-references between related sections.

https://claude.ai/code/session_01AZS3ko2CqaJY9tcWdKfakg

sroussey and others added 2 commits August 24, 2026 22:09
CLAUDE.md had grown to 3,062 lines / 197KB — loaded in full at the start of
every session, and mostly not about how to work in the repo. It was a running
log of extraction findings, corpus measurements and bug retrospectives, with
the actual conventions scattered between them.

CLAUDE.md is now 295 lines: overview, commands, packaging, architecture layers,
the cross-cutting rules that apply to any change, env vars, and conventions.
The rest moves to docs/, condensed, and is read on demand:

  docs/fetch-and-storage.md  fetch layer, EDGAR rate-limit ladder, Feed
                             tarballs, db setup/reset schema passes
  docs/extraction.md         models, dead letters, per-extractor sections,
                             segmentation, backfill
  docs/identity.md           observation/canonical/link/junction tiers,
                             normalizers, versioning, re-key ceremony
  docs/spac.md               lifecycle model, proxy gate, deregistration,
                             candidate screen
  docs/eval.md               eval harnesses, scoring, golden truth

Total is 2,701 lines against 3,062, so this is mostly relocation plus about
12% trimming — the point is what a session loads by default, which drops ~90%.

Removed rather than moved: prose restating what a function's own comments
already say. The dead-letter reason codes each carry their rationale in
ExtractionDeadLetterSchema.ts, so the doc now lists the vocabulary and points
there.

Corrected along the way: ExtractionDeadLetterSchema.ts is in
src/storage/dead-letter/, not src/storage/versioning/.

No rule or measurement was lost; the identifier sweep over the old file leaves
only code-level names their own comments cover.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZS3ko2CqaJY9tcWdKfakg
Rebasing onto main surfaced two claims the condensed docs had inherited from
the pre-rebase CLAUDE.md and that are now wrong:

- The in-job retry loop is gone. Retries throw RetryableJobError with retryDate
  and re-enter through the queue, so each one re-claims Concurrency +
  EvenlySpaced + the cluster RateLimiter. retrySpread() no longer exists
  anywhere in src, so the section documenting its jitter, the deterministic
  backoffDelay and the cap-then-spread ordering described removed code.
  Replaced with why the loop was removed, so it does not get re-added.
- SEC_FETCH_MAX_PER_SEC and SEC_FETCH_MAX_CONCURRENT both default to 4 now
  (were 8 and 16), and the concurrency cap binds at one second of latency
  rather than two.

Also: signalSecFetchThrottle's return now feeds RetryableJobError.retryDate,
and a blocked job throws rather than sleeping the cooldown while holding its
limiter token.

Verified against src/config/Constants.ts and src/task/fetch/SecFetchJob.ts
rather than against main's prose.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZS3ko2CqaJY9tcWdKfakg
@sroussey
sroussey merged commit f63a18c into main Aug 24, 2026
1 check passed
@sroussey
sroussey deleted the claude/audit-claude-md-files-q4672a branch August 24, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant