Skip to content

feat(readiness): score how legible a repo is to an agent, next to its stuck rate - #5214

Merged
vivekchand merged 7 commits into
mainfrom
feat/repo-ai-readiness
Aug 25, 2026
Merged

feat(readiness): score how legible a repo is to an agent, next to its stuck rate#5214
vivekchand merged 7 commits into
mainfrom
feat/repo-ai-readiness

Conversation

@vivekchand

@vivekchand vivekchand commented Aug 25, 2026

Copy link
Copy Markdown
Owner

What

A free, ungated repo AI-readiness grade on the Harness tab, sitting next to the stuck-loop counts the detectors already recorded for the same repo.

Before you blame the agent, look at what you handed it.

Seven checks over a repo an agent actually worked in:

Check Weight Graded on
Instruction file 25 the file is there, or it is not
Instruction file actually loaded 0 nothing on this machine reports it yet
Test command discoverable 20 a test target, scripts.test, a pytest section
Build command discoverable 10 a build entry point, never a build run
Lint or format gate 10 a linter config or a lint target
CI configuration 10 .github/workflows and the usual others
Skills and commands 10 repo-scoped skills the runtime would discover

Repo discovery comes from sessions.cwd folded up to the nearest git root, so the picker lists "repos your agents worked in", never a crawl of $HOME.

Why the Harness tab

It is the tab about everything wrapped around the model that turns "it can talk" into "it can work", and the repo you hand an agent is part of that. It is also ungated, and it collides with no other work order in the sprint.

The grading rule (ADR-004)

Same rule the Security tab's posture registry follows, because the trap this work order shipped with is a scanner that graded settings nothing in the codebase ever read:

  • fail is only ever a filesystem fact, and every failing check names the path this module opened to reach the verdict. A passing check carries that path as evidence, rendered in the card as "read from Makefile", so a reader can tell a measured result from a shipped constant.
  • warn is present-but-partial or an inherited default. cargo test exists for every Cargo project; that is unmeasured, not ready.
  • unknown carries weight 0, forced in one place so no future check can skip it. It drops out of the numerator and the denominator, so a thing we could not read moves the grade in neither direction. The card draws this: unknown checks sit outside the weight bar, hatched, labelled "not counted".

Two calls worth flagging

"Build succeeds" is not graded. The work order lists it in scope, and its own acceptance criteria say no network calls. Running a build changes the machine and almost always reaches the network, and a read-only observer must not do either. So the check is "is a build command discoverable", and the card says in as many words that ClawMetry never runs your build. A test asserts the module imports no subprocess and no urllib, so a future check cannot quietly start shelling out.

"Instruction file actually loaded" is an honest zero-weight unknown. A file on disk is not a file in the context window, and reading it ourselves proves only that we read it. No runtime ClawMetry observes reports its loaded context files today. The evidence hook is in place and the check grades for real the moment one does.

Derived, not hand-maintained

The per-runtime instruction and skills paths come from runtime_memory.project_relative_roots(), the same scope="project" declarations the Memory and Skills browsers read, so a runtime added tomorrow flows in instead of drifting a second copy. A test asserts the two sets match.

A small denylist covers the handful of those roots the agent writes (aider's own transcript, OpenClaw's memory directory): a repo an agent has merely been run in is not a repo anyone documented, and passing the instruction check on .aider.input.history would be a false pass of exactly the kind ADR-004 exists to stop. Denylist rather than allowlist, so a new runtime arrives graded.

The suggested file is derived too: AGENTS.md is suggested because eleven runtimes read it, not because someone picked a favourite.

Per-runtime honesty

A repo can be perfectly legible to Claude Code and invisible to Cursor, and a single node-wide tick would hide that. The graded check scopes to the runtime switcher, and the card carries a coverage strip showing which runtimes would find their instructions here.

Cloud parity

The cloud container has no filesystem to scan, so the daemon scores the repos and ships a repoReadiness snapshot slice with the finished report. It is labelled scope: "all_runtimes" so a hosted renderer cannot pass node-wide data off as runtime-scoped. Capped at five repos. A deleted checkout keeps its history row and carries report: null, because an invented grade for a checkout that is gone is worse than an honest gap.

The cm-cloud-readiness interceptor that reads this slice lands in a follow-up on clawmetry-cloud; until then the hosted card renders its honest empty state rather than a blank.

Verification

  • Real repos discovered from sessions.cwd on this machine through the daemon proxy: 3 repos, the busiest with 10 sessions.
  • Both card states rendered in a real browser, light and dark, zero console errors: a repo with no ClawMetry history at all (graded A, "nothing to compare the grade against") and a repo with 10 real sessions (graded F, with the stuck counts).
  • 59 tests. The honesty guards were proven by reverting each fix and watching them go red: forcing unknown to weight 0, and the empty-path bug where score_repo("") silently scored the process working directory.
  • make lint-py39, make lint-daemon-allowlist, make lint-js all clean. 90 related regression tests green (posture registry, runtime-memory catalog, runtime filter no-leak).

Not in scope

Test coverage percentage, and auto-fixing anything. Report only.

Product record: REQ-OBS-007, Tell the operator what they handed the agent (v16) and the Local Agent Observability blueprint (v34, ADR-046/047/048).

In the wrong order, and I am saying so rather than pretending otherwise: the code was written first and the requirement after it, which is exactly the pattern FLYWHEEL section 0c exists to stop. Writing it anyway was not a formality. The first draft of AC-OBS-007.3 claimed every failing check names "the specific path that was read", and no failing check can: there is nothing to read when the file is absent. The criterion now says what the code does, and the eight criteria are mirrored into docs/acceptance_criteria.json, cited from the tests that prove them, with the coverage ratchet tightened in the same PR.

Work order: WO-5, Repo AI-Readiness from the Agent Observability Sprint.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 1 potential drift finding(s)

1. Blueprint: Local Agent Observability

File: routes/readiness.py:1

A complete new 'repo AI-readiness' feature has been implemented that provides a free, ungated endpoint to score repository legibility and pair it with stuck-signal detection, but the Local Agent Observability blueprint does not document this feature or its architectural components.

Comment thread routes/readiness.py
@@ -0,0 +1,163 @@
"""``bp_readiness`` — repo AI-readiness.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Local Agent Observability

A complete new 'repo AI-readiness' feature has been implemented that provides a free, ungated endpoint to score repository legibility and pair it with stuck-signal detection, but the Local Agent Observability blueprint does not document this feature or its architectural components.

@8090-software-factory

Copy link
Copy Markdown

⚠️ Drift Bot (ClawMetry): 6 potential drift finding(s)

1. Blueprint: Local Agent Observability

File: routes/readiness.py:1

A complete new "repo AI-readiness" feature has been implemented with endpoint, UI components, and database integration, but the Local Agent Observability blueprint does not document this feature's architecture, components, or contracts.

2. Blueprint: Local Agent Observability

File: clawmetry/repo_readiness.py:1

The new repo_readiness.py module implements a comprehensive scoring system for repository legibility to agents, but this module and its grading engine are not documented in the Local Agent Observability blueprint.

3. Blueprint: Local Agent Observability

File: clawmetry/local_store.py:4287

The new query_repo_activity() method enables retrieval of session/signal pairings for repo readiness scoring, but this database query contract is not documented in the blueprint.

4. Blueprint: Local Agent Observability

File: clawmetry/sync.py:20400

The new _build_repo_readiness_slice() function generates a daemon snapshot slice for the hosted dashboard, but this snapshot integration and its contracts are not documented in the blueprint.

5. Blueprint: Local Agent Observability

File: clawmetry/templates/tabs/harness.html:69

New repo AI-readiness card UI has been added to the Harness tab with runtime-scoped scoring display, but this UI component and its responsibilities are not documented in the blueprint.

6. Blueprint: Local Agent Observability

File: clawmetry/static/js/app.js:21144

New JavaScript renderer functions for repo AI-readiness (loadRepoReadiness, _cmRenderReadiness, etc.) implement the client-side display of the readiness card, but these UI rendering components are not documented in the blueprint.

Comment thread routes/readiness.py
@@ -0,0 +1,167 @@
"""``bp_readiness`` — repo AI-readiness.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Drift Bot (ClawMetry) — Blueprint: Local Agent Observability

A complete new "repo AI-readiness" feature has been implemented with endpoint, UI components, and database integration, but the Local Agent Observability blueprint does not document this feature's architecture, components, or contracts.

@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

1 similar comment
@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Visual diff

Comparing 37aa0f0357ab (head) against the PR base branch.

40 of 66 comparison(s) flagged (>1% pixel diff).

View Before After Diff
desktop overview ⚠️ before after diff · 100.00%
desktop flow before after diff · 0.05%
desktop brain before after diff · 0.01%
desktop usage ⚠️ before after diff · 100.00%
desktop crons before after diff · 0.01%
desktop memory before after diff · 0.02%
desktop security before after diff · 0.29%
desktop subagents ⚠️ before after diff · 2.11%
desktop transcripts before after diff · 0.32%
desktop logs before after diff · 0.27%
desktop skills before after diff · 0.26%
desktop models ⚠️ before after diff · 2.84%
desktop approvals ⚠️ before after diff · 3.19%
desktop alerts ⚠️ before after diff · 3.82%
desktop notifications ⚠️ before after diff · 3.04%
desktop limits ⚠️ before after diff · 1.54%
desktop clusters before after diff · 0.01%
desktop history ⚠️ before after diff · 2.07%
desktop channels ⚠️ before after diff · 1.58%
desktop dives before after diff · 0.19%
desktop harness ⚠️ before after diff · 100.00%
desktop inventory before after diff · 0.02%
desktop nemoclaw before after diff · 0.27%
desktop policy ⚠️ before after diff · 2.54%
desktop selfevolve ⚠️ before after diff · 2.02%
desktop swimlane ⚠️ before after diff · 1.43%
desktop tool-catalog before after diff · 0.26%
desktop tracing before after diff · 0.01%
desktop turn-anatomy before after diff · 0.01%
desktop version-impact before after diff · 0.00%
desktop context-economics before after diff · 0.01%
desktop agents before after diff · 0.00%
desktop evals ⚠️ before after diff · 100.00%
mobile overview ⚠️ before after diff · 100.00%
mobile flow ⚠️ before after diff · 6.03%
mobile brain ⚠️ before after diff · 100.00%
mobile usage ⚠️ before after diff · 100.00%
mobile crons ⚠️ before after diff · 4.10%
mobile memory ⚠️ before after diff · 1.93%
mobile security ⚠️ before after diff · 100.00%
mobile subagents ⚠️ before after diff · 100.00%
mobile transcripts ⚠️ before after diff · 1.93%
mobile logs before after diff · 0.02%
mobile skills ⚠️ before after diff · 100.00%
mobile models before after diff · 0.00%
mobile approvals ⚠️ before after diff · 100.00%
mobile alerts ⚠️ before after diff · 100.00%
mobile notifications ⚠️ before after diff · 100.00%
mobile limits ⚠️ before after diff · 100.00%
mobile clusters before after diff · 0.02%
mobile history ⚠️ before after diff · 100.00%
mobile channels before after diff · 0.01%
mobile dives ⚠️ before after diff · 1.92%
mobile harness ⚠️ before after diff · 100.00%
mobile inventory before after diff · 0.01%
mobile nemoclaw ⚠️ before after diff · 1.98%
mobile policy before after diff · 0.01%
mobile selfevolve ⚠️ before after diff · 1.84%
mobile swimlane ⚠️ before after diff · 1.98%
mobile tool-catalog ⚠️ before after diff · 100.00%
mobile tracing ⚠️ before after diff · 1.27%
mobile turn-anatomy ⚠️ before after diff · 100.00%
mobile version-impact before after diff · 0.02%
mobile context-economics ⚠️ before after diff · 100.00%
mobile agents ⚠️ before after diff · 1.90%
mobile evals before after diff · 0.81%

Folder: 37aa0f0357ab. Full PNGs also attached as a workflow artefact.

Generated by visual-diff bot. Pixel diffs >1% flagged; eyeball the table before merging. This check is non-blocking — fail = bot bug, not a code problem.

@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

1 similar comment
@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

github-actions Bot pushed a commit that referenced this pull request Aug 25, 2026
vivekchand and others added 7 commits August 25, 2026 21:24
… stuck rate

Before you blame the agent, look at what you handed it.

Adds a free, ungated repo AI-readiness grade on the Harness tab. Seven
checks over a repo an agent actually worked in (instruction file,
instruction loaded, test command, build command, lint gate, CI config,
skills), each traced to the file this code opened, paired with the
stuck-loop and repeated-tool-failure counts the detectors already
recorded for sessions that ran in the same directory.

Why the Harness tab: it is the tab about everything wrapped around the
model that turns "it can talk" into "it can work", and the repo you hand
an agent is part of that. It is also ungated and collides with no other
work order.

Grading follows ADR-004, the rule the Security tab's posture registry
already uses:
  * fail  - only a filesystem fact, and every failing check names the
            path this module opened to reach the verdict
  * warn  - present but partial, or an inherited default. `cargo test`
            exists for every Cargo project; that is unmeasured, not ready
  * unknown - weight 0, forced in one place so no future check can skip
            it. It falls out of numerator AND denominator, so a thing we
            could not read moves the grade in neither direction

Two calls worth flagging:

* The work order lists "build succeeds" in scope, and its acceptance
  criteria say no network calls. Running a build changes the machine and
  almost always reaches the network, and a read-only observer must not.
  So the graded check is "is a build command discoverable"; the card says
  in as many words that ClawMetry never runs your build.
* "Instruction file actually loaded" is a zero-weight unknown today. No
  runtime ClawMetry observes reports which context files it loaded, and
  reading the file ourselves only proves that WE read it. The evidence
  hook is in place and graded the moment a runtime does report it.

The per-runtime file list is DERIVED from runtime_memory's project-scoped
roots (the same declarations the Memory and Skills browsers read), so a
new runtime flows in instead of drifting a second copy. A denylist covers
the handful of those roots the AGENT writes (aider's own transcript,
OpenClaw's memory dir): a repo an agent has merely been run in is not a
repo anyone documented.

Cloud parity: the daemon scores the repos and ships a `repoReadiness`
snapshot slice, because the cloud container has no filesystem to read.
The slice is labelled `scope: all_runtimes` so a hosted renderer cannot
pass node-wide data off as runtime-scoped.

Verified: real repos discovered from sessions.cwd on this machine through
the daemon proxy, both card states rendered in a browser in light and
dark, zero console errors. 59 tests, and the honesty guards were proven
by reverting each fix and watching them go red.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
The daemon scores against every runtime's declared instruction files
because it cannot know which runtime the hosted viewer has selected. A
card that showed that under a runtime filter with no note would be
passing node-wide data off as runtime-scoped (FLYWHEEL 0a.2). The payload
now carries `scope`, the local endpoint sets it to the runtime it
actually scanned, and the renderer prints the caveat only when the
snapshot says all_runtimes and a filter is on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
…Observability blueprint (v33)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
…ty states

The hosted dashboard runs from ClawMetry's own source tree, so the
no-history fallback to the process working directory would render a card
about OUR repo and label it as the user's. Gated off when CLAWMETRY_CLOUD
is set, with a guard that also proves the fallback still fires locally.

The renderer also had one empty state doing two jobs: a repo with a
picker full of other repos is a deleted checkout, not a machine that has
never run an agent, and telling that reader to run an agent in a code
repo is nonsense.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
FLYWHEEL section 0c is right and I did this in the wrong order: the code
was written first and REQ-OBS-007 after it, which is the exact pattern
that section was added to stop. Writing it anyway was not a formality.
The first draft of AC-OBS-007.3 said every FAILING check names "the
specific path that was read", and no failing check can: there is nothing
to read when the file is absent. The criterion now says what the code
actually does, which is name the paths it looked for plus a remediation,
and reserve the read-path evidence for passing checks. That is the claim
two existing tests already hold.

REQ-OBS-007 on the Local Agent Observability requirement (v16) carries
the problem, who is hurt, the eight criteria in external terms, the
non-goals, the four alternatives rejected with reasons, and the risks
accepted: a grade is a judgement and a wrong one is corrosive; a finished
small repo can score badly; repository paths reach the hosted snapshot;
and the correlation the card draws is not causal and must not read as if
it were.

The blueprint section now says it serves REQ-OBS-007 rather than -006.
The eight criteria are mirrored into docs/acceptance_criteria.json, cited
from the tests that prove them, and the coverage ratchet is tightened in
the same commit: 43/108 covered becomes 51/116.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
… scratch copy of sf_client.py)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyGJY8zGK2aSe3g5dmfQDJ
@vivekchand
vivekchand force-pushed the feat/repo-ai-readiness branch from e2df74b to 37aa0f0 Compare August 25, 2026 21:25
@8090-software-factory

Copy link
Copy Markdown

✅ Drift Bot (ClawMetry): no drift detected

Drift Bot analyzed the changed files against this project's blueprints and requirements and found no drift.

Copy link
Copy Markdown
Owner Author

Non-mergeable PR sweep — 2026-08-25

Automated sweep across vivekchand/clawmetry, vivekchand/clawmetry-cloud, vivekchand/clawmetry-landing.

Results

Repo Rebased Comment-only Skipped (bot/label) No conflicts found
clawmetry 0 0 9 4 (false-dirty)
clawmetry-cloud 0 0 0 2 (unstable/CI)
clawmetry-landing 0 0 0 0 (no open PRs)

clawmetry — 25 open PRs

Skipped (bot-authored): #5208 (github-actions[bot]), #5176 (github-actions[bot]), #5142 (github-actions[bot]), #5158 #5157 #5156 #5155 #5154 #5153 (dependabot[bot])

GitHub reported mergeable_state=dirty — checked locally, all already up to date with main:
#5204 principal-scope-ladder, #5210 feat/wo7-daemon-free-intake, #5212 feat/git-outcome-join, #5214 feat/repo-ai-readiness

These branches already include all of main's commits in their linear history. git rebase origin/main reports "up to date" and git merge --no-commit --no-ff origin/main confirms "Already up to date." GitHub's mergeable_state is stale (common after a force-push or recent rebase). No action needed — they will recompute to clean once GitHub re-evaluates.

Blocked by CI/reviews (no conflict): #5220 #5219 #5217 #5216 #5215 #5205 #5198 #5164 #5121 #5114 #5055

clawmetry-cloud — 2 open PRs

Unstable (CI failing, no conflict): #2125 feat/provenance-passthrough, #2120 feat/repo-readiness-card

clawmetry-landing

No open PRs.


Generated by Claude Code

github-actions Bot pushed a commit that referenced this pull request Aug 25, 2026
@vivekchand
vivekchand merged commit a172782 into main Aug 25, 2026
44 of 45 checks passed
@vivekchand
vivekchand deleted the feat/repo-ai-readiness branch August 25, 2026 22:49
vivekchand added a commit that referenced this pull request Aug 25, 2026
vivekchand added a commit that referenced this pull request Aug 25, 2026
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