Skip to content

feat(cli): reward prose-first, consolidated hubs over claim-logs (#142)#146

Merged
Connorrmcd6 merged 1 commit into
mainfrom
feat/142-claim-log-nudges
Jun 29, 2026
Merged

feat(cli): reward prose-first, consolidated hubs over claim-logs (#142)#146
Connorrmcd6 merged 1 commit into
mainfrom
feat/142-claim-log-nudges

Conversation

@Connorrmcd6

Copy link
Copy Markdown
Owner

Summary

Agents using surf write claim-logs — one claim per function, near-1:1 symbol→claim, almost no prose — because the CLI's in-loop signals reward it. Those signals (read every iteration) teach far more than prose docs (read once). This PR adds the missing counter-pressure that rewards prose and consolidation, then refactors our own flagged hubs to match.

Closes #142.

What changed & why

1. surf suggest reframed (surf-cli/src/suggest.rs) — highest leverage. Human output no longer reads as "a list of claims to write." It states these are undocumented symbols, groups them by file, and emits a single multi-site at: skeleton with prose-first scaffolding, so the default shape models a good hub. --format json is byte-unchanged (the json_shape_has_no_hash contract holds).

2. Symmetric claim-level lint nudges (surf-cli/src/lint.rs) — both advisory, exit-0, never blocking, mirroring the existing lint_coarse_span pattern:

  • claim-log — a hub with ≥4 claims that never once uses a multi-site at: list (the per-symbol smell). A hub that consolidates even one behavior is exempt.
  • thin-prose — a multi-claim hub whose body prose (code fences excluded) is below ~15 words/claim.

3. Prose-first surf new scaffold (surf-cli/src/new.rs) — ships ## How it works / ## Boundary headings and a multi-anchor example claim (stays anchors: [], so lint-clean).

4. Docsdocs/guides/authoring-hubs.md promotes the multi-site at: list from a staleness footnote to the default for system claims and adds an "A hub is an onboarding doc" section with a good/bad contrast; AGENTS.md step 4 now says extend an existing claim's prose / add an anchor site before writing a new granular claim.

5. Dogfooding the change. The new warnings flagged 6 of our own hubs. Fixed all 6:

  • Added real onboarding prose to the 5 thin hubs (cli-check, cli-workspace, hash, hub-format, cli-git) — body-only, no hashes touched.
  • Gave cli-git the repo's first multi-site claim: one invariant (every git query degrades to None; the verdict never depends on it) sealed across all five helpers, letting us trim per-function boilerplate. Re-stamped via surf verify.
  • Logged the moment (and its resolution) in docs/dogfood-log.md.

New-warning hits on our hubs: 6 → 0. (The 16 pre-existing under-coverage warnings predate this PR and are left as separate cleanup.)

Verification

All run on this branch:

Gate Result
cargo fmt --all --check ✅ clean
cargo clippy --all-targets --all-features -- -D warnings ✅ no warnings
cargo test --all ✅ 202 passed, 0 failed (2 ignored)
surf check (dogfood) ✅ all anchored spans match
surf lint (dogfood) ✅ exit 0; 0 claim-log, 0 thin-prose; 16 pre-existing under-coverage

🤖 Generated with Claude Code

The CLI's in-loop signals — `surf suggest` and `lint`'s under-coverage nudge —
were the de-facto teachers, and both pushed agents toward one claim per
function: a near-1:1 symbol→claim "claim-log" with no prose. Nothing rewarded
consolidation or prose, so hubs drifted away from being onboarding docs.

Add the missing counter-pressure across the surfaces agents actually read:

- suggest: human output is reframed as a list of *undocumented symbols, not
  claims*. It groups symbols by file and emits a multi-site `at:` skeleton with
  prose-first scaffolding, so the default shape models a good hub. JSON output
  is unchanged.
- lint: two advisory (exit-0) warnings mirror the existing granularity nudges —
  a claim-log warning (several claims, never a multi-site `at:`) and a
  thin-prose warning (multi-claim hub with a stub body).
- new: the scaffold ships prose-first headings and a multi-anchor example.
- docs: authoring-hubs.md promotes the multi-site `at:` list to the default for
  system claims and adds a "hub is an onboarding doc" section; AGENTS.md step 4
  now says extend an existing claim before writing a new granular one.

Then eat the dogfood: the new warnings flagged 6 of our own hubs. Add real body
prose to the 5 thin ones, and give `cli-git` the repo's first multi-site claim —
one invariant ("every git query degrades to None; the verdict never depends on
it") sealed across all five helpers — clearing every new-warning hit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Connorrmcd6 Connorrmcd6 merged commit 56cd7cb into main Jun 29, 2026
4 checks passed
@Connorrmcd6 Connorrmcd6 deleted the feat/142-claim-log-nudges branch June 29, 2026 08:40
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.

Agents write granular claim-logs because the CLI's in-loop signals reward per-function anchoring

1 participant