update codebase discovery - #2
Open
bsigney wants to merge 40 commits into
Open
Conversation
…and move component content checks out of the format gate
…flag both still said the flag cant persist: phase 0 that none survives recon, the contrast that nobody has looked at the code.
it sat below the resume and initialise steps, so an agent reading in order could overwrite the state before reaching the sign-off.
…er instead of phase 5s summary adds the three checks the doc verifier can actually run, with the sign-off limit stated.
…ng the default, the anchor and the --output escape condition next to a pointer at the file that owns them.
…d and move the _discovery disposition out of the file phase 3 has to read
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.
Rework codebase-discovery for safe writes, single-sourced rules, and declared-structure recon
Reworks the
codebase-discoveryskill so it is safe to run against a repository it does notown, and states each of its rules once instead of restating them across files.
Six phases now instead of five. Four new reference files own a rule apiece. One command and two
vendored config files are gone.
Writing into someone else's repo
The skill used to assume
docs/and start writing. Phase 0 now surveys the target first: itdetects whether
docs/belongs to a documentation generator (MkDocs, Docusaurus, Sphinx,Jekyll, Hugo, mdBook, VitePress), lists what already occupies the target paths, and agrees the
output root with the user before anything is written.
references/write-contract.mdowns those rules: where the root may sit, that nothing is writtenoutside it apart from the project-root README, that a file the skill did not author is never
overwritten without sign-off, and that a published site's nav is never touched without a
decision.
--freshnow needs confirmation when a previous run's state exists. Wiping_discovery/losesinterview progress that git cannot recover, since two of those four files are git-ignored by
recommendation.
Trust boundary and secrets
Everything read from the target repo is data about the system, never instruction. Text that
addresses the reader or asks for behaviour becomes a finding to report rather than a directive
to follow, and
.cursorrulesor a target-repoCLAUDE.mdis read as evidence of what that teamtold its agents.
The secrets rule is fixed and normative in one place: record a credential by name and location,
never the value. A live-looking secret in source is a security finding to raise for rotation,
not documentation.
Both rules are restated only in the two bundled subagents, which cannot resolve a path into the
skill.
scripts/checks/codebase-discovery.jsfails the build if those copies drift.Output layout
The skill files docs one concept per file, under names drawn from the domain language, so an
agent working on billing loads
areas/billing/rather than every rule in the system.Area-specific material lives in its area, anything no single area owns stays at the top level,
and the glossary stays a single file.
The grouping is treated as a finding, not filing. Code shows which files sit together; it does
not show that the business recognises the cluster as a concept. So a cluster is named after the
code unit it came from and carries
[unverified]until a stakeholder confirms it, at whichpoint the file is renamed to the agreed term.
Recon
Recon reads the structure the repo declares before inferring anything from patterns.
references/navigation.mdsets out the ladder: declared manifests, then the repo's owntoolchain, then text search as the floor, with AST and LSP optional above it. Whichever tier
answered a question sets the confidence, so a boundary read from
go.modoutranks one greppedfrom imports.
Git is no longer a knowledge source. It is used for the freshness check only, because commit
messages do not reliably carry domain language and decay as history lengthens.
Tier 0 can now recommend against the deep dives. Where the map shows configuration and
infrastructure rather than business logic, the skill says so and offers to write the
architecture note straight from the map.
Freshness and resuming
references/freshness.mdis new. Staleness is detected by comparing the recorded recon commitagainst HEAD, never by timestamps, since a fresh clone rewrites every mtime. When there is
drift the user picks what happens, and declining to re-recon reverts the affected claims to
[unchecked]instead of leaving them reading as accepted.A resume table decides which phase to re-enter from what the working state records. The
stakeholder can stop the interview at any point, and the remainder is parked in the register as
needs SME.
Provenance
The flag vocabulary is closed to five:
[unchecked],[unverified],[assumption],[outdated],[contradicted].[unchecked]is new and means no current code check, coveringboth a doc claim nobody has compared yet and a claim whose code has moved since. Inventing a
sixth fails the gate.
Verification gate
Content checks moved out of
scripts/validate.js, which stays format-only andcomponent-agnostic.
scripts/checks/loads automatically and holds per-component invariants:the two canonical rule wordings, the closed flag vocabulary, and agreement between the three
places the output layout is stated.
Removals
commands/codebase-discovery.mdis deleted. The skill isuser-invocable, so it alreadyexposes
/codebase-discovery, and a same-named command collided with it. That rule is nowwritten down in
commands/README.mdandCONTRIBUTING.md.The vendored
references/lsp-mcp/configs are deleted. LSP guidance is capability-based now,and pinning a third-party bridge's config in this repo would rot silently.
Prose
A pass with the humanizer and avoid-ai-writing skills over the skill and the repo docs. Em dash
rate in the skill dropped from 17.6 per 1,000 words to 0.6. Both gate-pinned rule wordings,
every table, code fence and normative blockquote were left untouched, and heading count, fence
count and the set of link targets are unchanged.