Skip to content

feat(capabilities): check and size docs/capabilities area files - #502

Open
byronwall wants to merge 6 commits into
mainfrom
claude/capabilities-proto1-56e1d1
Open

byronwall wants to merge 6 commits into
mainfrom
claude/capabilities-proto1-56e1d1

Conversation

@byronwall

@byronwall byronwall commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

srcly capabilities check reads a repo's capabilities map (docs/capabilities/*.yaml) and fails when it drifts from the code: a new code file no capability claims, a path or only: name that no longer resolves, or a built capability with no test. It also sizes each capability in allocated LOC and prints the same facts as JSON for agents and the coming capability treemap.

What you'll see

  • srcly capabilities check [repo] prints a verdict, each error with its fix, every capability with its allocated LOC and tests, and the largest unclaimed files. It exits 1 on any error.
  • --format json gives nodes, resolved refs (each only: name with the line it resolved to, or its candidates), allocated LOC with exact fractions, unclaimed files, shared files and diagnostics.
  • --base <ref> (default origin/main) compares with the merge base; --no-base skips the new-code and deleted-test rules.
  • The schema and rules are in docs/capabilities.md. The agent recipe that drafts a map from Srcly's facts is skills/srcly-capabilities/SKILL.md.

Proof

On Visual Notes with its drafted map (byronwall/visual-notes#375), the check passes, and the totals add up:

$ srcly capabilities check ~/Projects/visual-notes-worktrees/capabilities-draft
Capabilities: 148 in 21 area files (docs/capabilities/)
Base: origin/main merge base 08093d850f
Code: 180,018 LOC in 1,394 files. Claimed 154,739 LOC (86.0%, 1,107 files); unclaimed 25,279 LOC (287 files). Totals + unclaimed = eligible.

Capabilities (allocated LOC, own files, tests resolved/linked):
  activity: 2,587 LOC, 16 files, tests 2/2 · Activity timeline
  admin: 1,744 LOC, 0 files, tests 0/0 · Admin tools
    admin-migrations: 1,744 LOC, 8 files, tests 1/1 · Data migrations
  ...
PASS

The same tree fails after an agent adds an unclaimed file, and passes once the map claims it:

Errors (1):
  [unclaimed-new-code] app/src/lib/events/week-agenda.ts (3 LOC) is new since base and no capability claims it
      → add it to the entry or implementation of the capability it serves
FAIL: 1 errors        (exit 1)
...
PASS                  (exit 0)

The first check on Visual Notes, with a fresh scan, took 5.2 s wall time. server/tests/test_capabilities.py (25 tests) builds a small Git repo and covers each rule: unclaimed new code, stale paths with rename, case and glob hints, ambiguous only: names, missing and deleted tests, a removed map, a missing base, invalid data, bracket route files ([id].tsx), and exact LOC conservation for a file split three ways. scripts/check.sh server: 687 passed.

Codex review ran 3 rounds. Round 1 (4 P1): an unavailable base let unclaimed code pass, a regex title matcher counted commented-out tests, a README counted as a test, and an old case spelling stayed valid on macOS. Round 2 (3 P1): a deleted map passed with no base, test.step stood in for a test, and JSX in .test.js hid titles. All are fixed: titles now come from tree-sitter, and a test link must be a test or fixture file. Round 3 passed with 3 P2s; two are fixed (test.fail titles, a comment before a title).

Survey moves: server traces 215 → 224 (+9, all partial) and their stops (filesystem +18, unproven-handoff +1, budget-exhausted +15, external-code +311) come from the new corpus files server/app/services/capabilities/{anchors,check,model}.py and reporting.load_or_scan. No analysis code changed; client and value-flow-basics did not move.

Limits

  • Head is the working tree, so the check runs before a commit. A rename Git cannot see (an untracked new file) counts as new code.
  • deleted-test is a review item, not an error. A deleted test fails the check only when it leaves the capability with no test.
  • The check reuses Srcly's analysis cache, or scans the repo when no file is cached.
  • No CI wiring (W3.4) and no treemap UI (W3.5) yet. They wait on Byron's read of the Visual Notes draft.
  • Adds pyyaml to the server's dependencies.

Open findings

  • P2 · diff · server/app/services/capabilities/check.py:278 — Code inside a checked-out Git submodule is in Srcly's scan but not in git ls-files, so the check leaves it out of eligible LOC and cannot claim it. Open: needs a recursive inventory and base reads at the gitlink commits; no mapped repo has submodules yet.
  • Architecture note from round 3: build one capability snapshot per side from a shared file inventory and anchor extractor, and use it for both lint and LOC. Worth doing with the PR view (W4.1), which needs base and head snapshots anyway.

Stack: capabilities

What splits: the capabilities file's check (CLI and JSON), the Capabilities view built on it, and a design pass on that view.
Why it splits: the check is core logic that a CLI and CI use on their own; the view is UI you judge on screenshots; the design pass is a restyle you can take or leave.
Why this split: one PR would mix an algorithm review with a UI review. Splitting the check into parser and lint layers was rejected: the rules and the parser only make sense together.

  1. feat(capabilities): check and size docs/capabilities area files #502: srcly capabilities check, its docs and the agent recipe.
  2. feat(capabilities): capability treemap view in Srcly #503: GET /api/capabilities and the Capabilities view.
  3. feat(capabilities): weak tests first, hover cards and search in the capability view #504: the 10x pass: weak tests first, hover cards, search.

🤖 Generated with Claude Code

byronwall and others added 6 commits November 28, 2026 22:50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, exact shares

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… shares, base-missing on removed maps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…title

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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