feat(cli): reward prose-first, consolidated hubs over claim-logs (#142)#146
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agents using
surfwrite 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 suggestreframed (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-siteat:skeleton with prose-first scaffolding, so the default shape models a good hub.--format jsonis byte-unchanged (thejson_shape_has_no_hashcontract holds).2. Symmetric claim-level lint nudges (
surf-cli/src/lint.rs) — both advisory, exit-0, never blocking, mirroring the existinglint_coarse_spanpattern:at:list (the per-symbol smell). A hub that consolidates even one behavior is exempt.3. Prose-first
surf newscaffold (surf-cli/src/new.rs) — ships## How it works/## Boundaryheadings and a multi-anchor example claim (staysanchors: [], so lint-clean).4. Docs —
docs/guides/authoring-hubs.mdpromotes the multi-siteat: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.mdstep 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:
cli-check,cli-workspace,hash,hub-format,cli-git) — body-only, no hashes touched.cli-gitthe repo's first multi-site claim: one invariant (every git query degrades toNone; the verdict never depends on it) sealed across all five helpers, letting us trim per-function boilerplate. Re-stamped viasurf verify.docs/dogfood-log.md.New-warning hits on our hubs: 6 → 0. (The 16 pre-existing
under-coveragewarnings predate this PR and are left as separate cleanup.)Verification
All run on this branch:
cargo fmt --all --checkcargo clippy --all-targets --all-features -- -D warningscargo test --allsurf check(dogfood)surf lint(dogfood)🤖 Generated with Claude Code