@nazty_labs/common-ground 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/SETUP.md +219 -0
- package/dist/access.d.ts +172 -0
- package/dist/access.js +175 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +198 -0
- package/dist/commands.d.ts +189 -0
- package/dist/commands.js +202 -0
- package/dist/discovery.d.ts +73 -0
- package/dist/discovery.js +417 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -0
- package/dist/export.d.ts +14 -0
- package/dist/export.js +86 -0
- package/dist/guidance.d.ts +11 -0
- package/dist/guidance.js +75 -0
- package/dist/hooks.d.ts +4 -0
- package/dist/hooks.js +141 -0
- package/dist/init.d.ts +304 -0
- package/dist/init.js +150 -0
- package/dist/maintenance.d.ts +126 -0
- package/dist/maintenance.js +23 -0
- package/dist/matching.d.ts +17 -0
- package/dist/matching.js +32 -0
- package/dist/model.d.ts +974 -0
- package/dist/model.js +21 -0
- package/dist/navigation.d.ts +164 -0
- package/dist/navigation.js +164 -0
- package/dist/operations.d.ts +10 -0
- package/dist/operations.js +130 -0
- package/dist/paging.d.ts +5 -0
- package/dist/paging.js +32 -0
- package/dist/retrieval.d.ts +146 -0
- package/dist/retrieval.js +150 -0
- package/dist/review-files.d.ts +3 -0
- package/dist/review-files.js +106 -0
- package/dist/review.d.ts +86 -0
- package/dist/review.js +124 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +105 -0
- package/dist/source-search.d.ts +63 -0
- package/dist/source-search.js +245 -0
- package/dist/store.d.ts +452 -0
- package/dist/store.js +718 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/workflow.d.ts +450 -0
- package/dist/workflow.js +317 -0
- package/docs/architecture.md +65 -0
- package/docs/audit-0.4.0.md +42 -0
- package/docs/demo.md +42 -0
- package/docs/discovery.md +70 -0
- package/docs/knowledge-policy.md +51 -0
- package/docs/pillar-contract.md +98 -0
- package/docs/quiet-workflow.md +98 -0
- package/docs/releases.md +157 -0
- package/package.json +52 -0
- package/schemas/admission.schema.json +75 -0
- package/schemas/knowledge.schema.json +192 -0
- package/schemas/patch.schema.json +220 -0
- package/schemas/update.schema.json +218 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Knowledge policy
|
|
2
|
+
|
|
3
|
+
Start at [START_HERE.md](../.common-ground/START_HERE.md). Use stateless lookup and assessment by default; task contexts are optional; the full MCP profile retains the original individual tools. Common Ground is a cache of the codebase, never authority over source or developer instructions.
|
|
4
|
+
|
|
5
|
+
### Reading
|
|
6
|
+
|
|
7
|
+
- Notes supplement codebase reading; they never replace it. Code is the source of truth. Open the source files behind a fact before relying on or changing it.
|
|
8
|
+
- Navigate ownership_map → pillar chapter index → relevant chapter pages → facts and source. Signal matches are hints, not diagnoses. Read pillar_graph and fact dependencies when work crosses subsystems.
|
|
9
|
+
- Read a directory's README when present, plus applicable ancestor, sibling, child, and referenced documentation. Explain facts to people in plain language with evidence; disclose stale or uncertain claims.
|
|
10
|
+
- Branches, submodule checkouts, current failures, and other point-in-time state must be derived live on every check. Never cache them as durable facts.
|
|
11
|
+
|
|
12
|
+
### Scope and writing
|
|
13
|
+
|
|
14
|
+
- Cache verified subsystem behavior, architecture, connections, build/deploy mechanics, established conventions, and the commands that drive the code. Describe patterns that change how someone reasons about the subsystem, not inventories.
|
|
15
|
+
- Exclude bugs, open issues, work to fix, incident postmortems, debugging narratives, activity logs, generic technology explainers, secrets, and anything not verified against current source.
|
|
16
|
+
- Library-local detail belongs in that library's README. Keep subsystem-wide reasoning in the existing pillar/chapter and reference local documentation where useful; do not duplicate inventories.
|
|
17
|
+
- Verified means you opened and read the relevant source during this session. Memory, guesses, unsupported inference, and cached quotes do not establish verification. Exact quotes and hashes cannot prove semantic truth.
|
|
18
|
+
- Default to no note write. Silence is valid: an unwritten fact costs nothing; a wrong one costs every reader. When uncertain, explicitly state what cannot be verified. Ask immediately only when it blocks the developer task; otherwise collect the question for task completion. Never guess or silently accept a contradiction.
|
|
19
|
+
- Classify into existing pillars and chapters first. Never add a pillar unless a new, uncovered, standalone subsystem warrants it and the developer approves. Chapters, ownership expansion, and fact admission also require developer direction; approval flags do not supply that direction.
|
|
20
|
+
|
|
21
|
+
### Maintenance and correction
|
|
22
|
+
|
|
23
|
+
- Touch it, own it: before adding or changing a fact, skim every page of the whole logical chapter, then review affected sibling/child chapters and reference files. Use review_plan and review_checklist; include all required dependency/dependent chapter reviews.
|
|
24
|
+
- In that same edit, merge verified near duplicates, remove superseded content, and tighten narrative in the affected scope. Use explicit maintenance actions and reasons, preserving existing IDs for corrections. Repair affected references and dependency links in the same transaction. Do not clean up unrelated subsystems.
|
|
25
|
+
- If an authorized code change contradicts a fact, chapter, pillar, or documentation claim, correction is mandatory in the same edit. Correct in place; never retain old and new contradictory versions or append a contradiction below the original. If boundaries themselves are wrong, raise the ownership change with the developer.
|
|
26
|
+
- Corrections trigger the same full-file, sibling, child, and reference review as other touches. If the right version cannot be verified, say so explicitly and ask at the appropriate task boundary; do not publish a guessed resolution.
|
|
27
|
+
- No note change does not end the check. Re-read the modified directory README and relevant documentation and ensure they remain valid, even when prepare_update returns noop.
|
|
28
|
+
- Any developer may request cground tidy all, PILLAR, PILLAR/CHAPTER, or PILLAR/CHAPTER/FACT (a unique fact ID also works). This creates a scoped plan and local tidyId; the calling agent reads source and submits the verified cleanup. It neither invokes a model nor edits knowledge automatically. MCP tidy_plan only previews scope. The cground MCP tool exposes every CLI workflow: operation:help lists operations and help with args.operation returns its input schema. Use check or validate with a target; stale results list affected pillars, chapters and facts and ask "Start automatic cleanup?". With developer-requested cleanup, cleanup:true returns a scoped tidyId. The calling agent must verify source, submit reviewed corrections, then validate again. Use tidy for an explicitly requested broader cleanup.
|
|
29
|
+
- Citation-only corrections can use empty touched paths without a tidy request when IDs, statements, ownership scopes and dependencies stay unchanged. A reason, full linked-chapter review, exact evidence and source/revision checks remain required.
|
|
30
|
+
- For prepare_update, attest verification.sourceFiles and verification.documentFiles only after reading them this session (or verifying a deletion live). Use review_checklist for required paths and include newly cited evidence. Facts may contain up to 2,000 characters. Keep one coherent claim with enough context, conditions, and consequences to be useful; do not pad to the limit. Every assertion must be source-backed and free of temporary state.
|
|
31
|
+
- Submit one complete transaction for affected chapters. Only changed chapters are rewritten; unchanged reviews use ignored local state. Existing correct facts stay unchanged unless explicit maintenance is justified. Never skip required tests based on stored notes.
|
|
32
|
+
- For initial setup, “initialize” or “generate a map” requests a draft by default. Explicit developer delegation to save/publish verified initial boundaries and facts authorizes publication within that scope without another approval question. Verify source, preflight and report the saved map; flags and content tokens never prove human review. Draft-only and boundary-only requests do not authorize fact publication. Routine task additions still follow the approval workflow below.
|
|
33
|
+
- Agents execute approved bootstrap/admission operations. Apply the same reading, verification, deduplication, and README checks before seed or admit. Commit durable knowledge and documentation with the code; keep .common-ground/local/ ignored.
|
|
34
|
+
|
|
35
|
+
### Quiet task workflow
|
|
36
|
+
|
|
37
|
+
- The developer task comes first. Use stateless lookup for relevant facts and source paths; default freshness is not checked. Assess actual task-touched paths after edits. Task contexts are optional for deferred additions and aggregate reporting, not required for trivial edits or standalone corrections.
|
|
38
|
+
- Existing facts in the affected scope have standing permission for verified corrections, merges, removals, and tightening. Maintain them quietly while doing authorized work. Never run an unrelated tidy or expand ownership without developer direction.
|
|
39
|
+
- Call cground assess (or task_context assess when using a task) with the files this task actually touched, including new and deleted files. Do not use the whole dirty Git tree as your own work. A no-fact-review result still requires the relevant README/documentation check. Path matching cannot establish semantic independence: follow additional references uncovered in source.
|
|
40
|
+
- Before any knowledge edit, read this policy and every page of each required logical chapter. Use read_knowledge kind review/checklist and chapter with evidence:true to batch records. reviewedAllFacts:true declares review of the whole expected revision; it does not permit a partial skim. prepare_patch accepts an optional taskId and sends replacements/removals only; it retains all other facts and applies the same validation as prepare_update.
|
|
41
|
+
- Keep new verified fact candidates in propose_facts during work. This creates ignored local drafts only. Most new components need only their README; propose a fact only when it changes subsystem reasoning. Do not interrupt the main task for fact admission.
|
|
42
|
+
- After the main task and its checks, finish a task context only if one was started, read all result pages, and consolidate the final message. Present a compact delta of actual corrections already applied in the Git working tree: pillar/chapter, before → after, reason, source links and a keep/reverify recommendation. Present all proposed additions together with their evidence and ask: "Ready to make the following facts available to the team?" Wait for explicit approval before admission. Do not send the developer to knowledge.json or ask them to edit it. Hide unchanged facts, hashes and revision churn. Use task completion details for this task, and cground review (or MCP review) for changes against Git HEAD; --staged selects the index. Read every result page and fetch exact changed quotes with --evidence only when needed. State uncertainty instead of recommending an unsupported approval. For pending pillars/chapters, explain the responsibility, boundaries, ownership paths, rationale and source support before asking for approval. Review summaries reduce presentation tokens; complete chapter and source verification is still mandatory. Do not report routine lookups, checks, no-op reviews, or empty outcomes. Mention unresolved contradictions or failed maintenance explicitly at completion; ask earlier only if needed to complete the main task correctly.
|
|
43
|
+
- After explicit developer approval, read proposed facts (kind proposals), the proposal-review checklist, all required existing chapters, sources and documentation. Then run cground accept-facts TASK_ID REVIEW.json --approve, or the cground MCP accept-facts operation with taskId, review and approved:true. REVIEW.json includes reviews [{chapterId, expectedRevision, reviewedAllFacts:true}] and verification {sourceFiles, documentFiles}. The whole queued batch is validated before one registry write. If approval covers only some entries, use cground drop-facts TASK_ID FACT_KEY... to discard the rest first. A changed draft needs fresh source verification and a new task/approval batch.
|
|
44
|
+
- Pending facts are never used as authoritative knowledge. Dependencies on other pending drafts are not supported; admit the prerequisite after approval first. Approval flags are declarations of developer direction, not a permission or security boundary; never treat a flag as approval.
|
|
45
|
+
- Reuse unchanged responses only within the same live task context. An unchanged/reference response means use the previously returned context, not that source was read. Request refresh:true after context loss, or start a new task for a new agent/session. Live source and dependency fingerprints invalidate reuse. Never cache branch/submodule state as knowledge.
|
|
46
|
+
- Common Ground is invoked by the calling agent, not an autonomous watcher. If unavailable, continue safe main-task work and report unresolved maintenance at completion. Do not claim a correction succeeded when a tool failed. The MCP host controls its own tool approval prompts.
|
|
47
|
+
|
|
48
|
+
Full-profile tools: start_here, ownership_map, pillar_graph, tidy_plan, review_checklist, list_pillars, list_chapters, read_chapter, read_fact, search_knowledge, review_plan, prepare_update, commit_update, cground.
|
|
49
|
+
Validation: cground validate [all|PILLAR|PILLAR/CHAPTER|PILLAR/CHAPTER/FACT] preserves shared knowledge and refreshes the ignored local Markdown view; omitted targets mean all. It checks structure, exact evidence, and freshness, not semantic truth.
|
|
50
|
+
|
|
51
|
+
CLI: cground start "build failed"; cground owners --path PATH; cground graph PILLAR; cground tidy TARGET; cground review-checklist CHAPTER --touched PATH.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Pillar, chapter, and fact contract
|
|
2
|
+
|
|
3
|
+
A pillar owns a stable repository responsibility. A chapter owns a coherent subarea within it. Facts belong to chapters and have stable IDs within their chapter. A chapter key is `pillar-id/chapter-id`.
|
|
4
|
+
|
|
5
|
+
Chapter definitions include a title, scope, exclusions, literal repository-relative file/directory paths defining an authoring boundary. Facts carry their own `sourceScope`, evidence, and `dependsOn` references in `pillar/chapter/fact` form. Scopes must not overlap; fact dependencies must reference an existing fact and cannot refer to themselves. Fact dependencies may cross chapters and pillars. Cycles terminate safely during traversal. New pillars and chapters require developer approval; new pillars also require an uncovered standalone responsibility.
|
|
6
|
+
|
|
7
|
+
Facts have no count ceiling. A fact statement is limited to 2,000 characters and requires exact source evidence. Its source scope stays within its chapter's authoring boundary, but supporting evidence may cite other repository files. Every evidence file is tracked for freshness independently of ownership and source scope; evidence does not confer ownership. Trailing directory slashes normalize away; traversal, absolute paths and symlinks remain rejected. Matching quotes and hashes establish evidence presence and freshness, not semantic truth.
|
|
8
|
+
|
|
9
|
+
## Navigate without loading the whole knowledge base
|
|
10
|
+
|
|
11
|
+
For everyday reads use stateless `cground lookup`; default freshness is not checked, and `--verify` checks selected facts and dependencies. Use `cground assess --touched` after changes, then `--review` only when correction needs complete chapters and verification paths. Task contexts are optional for deferred additions and aggregate reporting. Use `read_knowledge` to retrieve bounded indexes, chapters and full evidence batches. Its kinds map to the detailed operations below. To use these original MCP tool names, select `--profile full`; CLI commands remain unchanged.
|
|
12
|
+
|
|
13
|
+
Start with the full-profile `start_here` or `.common-ground/START_HERE.md`. `ownership_map` routes registered paths and keyword signals to candidate pillars/chapters. Paths have literal ownership semantics; signal text matches boundary, fact, and evidence tokens and is only a hint. `pillar_graph` groups cross-pillar fact dependencies into directed edges, with example fact references and freshness. It does not infer missing dependencies. All these indexes are paginated.
|
|
14
|
+
|
|
15
|
+
1. `list_pillars` gives responsibility boundaries and chapter counts.
|
|
16
|
+
2. `list_chapters` gives a pillar's chapter index: titles, scopes, revisions, and fact counts. It does not return facts.
|
|
17
|
+
3. `read_chapter` gives one chapter's fact summaries in pages (default 10, maximum 20). Follow `nextCursor` to read more. Cursors reject content changes between pages.
|
|
18
|
+
4. `read_fact` fetches the evidence for a particular fact. `search_knowledge` offers bounded keyword search, optionally scoped to a chapter.
|
|
19
|
+
|
|
20
|
+
These response limits do not limit stored facts or chapter counts. Source fingerprints are not dumped into agent read responses.
|
|
21
|
+
|
|
22
|
+
## Compact patches and task-time admission
|
|
23
|
+
|
|
24
|
+
`prepare_patch` accepts optional `taskId`, `chapterId`, optional initiating `factIds`, `touchedPaths`, `verification`, optional `tidyId`, and complete chapter review declarations. Each review carries `chapterId`, `expectedRevision`, `reviewedAllFacts: true`, `reason`, optional `maintenance`, `replacements` containing only changed existing full fact records, and `removeFactIds`. Without taskId, preparation creates only the review proposal and requires no task start/finish; corrections are reported directly. With taskId, task completion aggregates committed corrections. The server reconstructs unchanged facts and the complete reviewed ID set before invoking the validator described below. A stale revision, unknown/duplicate edit ID, missing chapter, or incomplete source/documentation declaration rejects the request. Whole-chapter reading remains mandatory.
|
|
25
|
+
|
|
26
|
+
Use `propose_facts` for new records during a task; these are local drafts excluded from retrieval. After `task_context finish` and explicit developer approval, `cground accept-facts TASK_ID REVIEW.json --approve` validates a batch. REVIEW.json has `reviews: [{chapterId, expectedRevision, reviewedAllFacts: true}]` and `verification: {sourceFiles, documentFiles}`. Read `read_knowledge` kinds `proposals` and `proposal-review` for the complete drafts and required files/chapters. Admission reviews whole owning chapters and linked chapters and rejects changed draft evidence/dependencies/chapters. Correct stale existing facts before staging additions. Discard rejected entries with `cground drop-facts TASK_ID FACT_KEY...`; an altered draft requires fresh review and approval. See [the quiet workflow](quiet-workflow.md).
|
|
27
|
+
|
|
28
|
+
## Dependency-aware review and update
|
|
29
|
+
|
|
30
|
+
`Fact A.dependsOn = [Fact B]` means A relies on B. A changed B may invalidate A. Before editing any fact, call `review_plan` for the affected chapter. Pass optional `factIds` to identify initiating facts. Without them, all facts in the initiating chapter are considered. The beta follows fact dependencies and reverse dependents transitively, then requires full review of the chapters containing those facts. It does not traverse unrelated facts merely because they share a chapter. Dense fact graphs can still require broad review. Unknown or ambiguous impact requires developer input.
|
|
31
|
+
|
|
32
|
+
Read every fact page for each required chapter. Submit one update request with:
|
|
33
|
+
|
|
34
|
+
- `chapterId`: the chapter that initiated the review.
|
|
35
|
+
- `factIds`: optional initiating fact IDs matching the review plan.
|
|
36
|
+
- `touchedPaths`: repository paths touched by the authorized task. May be empty for fully reviewed citation-only repairs or with a developer-requested `tidyId`.
|
|
37
|
+
- `reviews`: one entry for every required chapter, with `chapterId`, `expectedRevision`, `reviewedFactIds`, `invalidatedFactIds`, the complete replacement `facts`, and a `reason`.
|
|
38
|
+
- `verification`: `sourceFiles` and `documentFiles` that the agent actually opened in this session (or verified as deleted). Get required paths from `review_checklist`, using the chapter IDs and touched paths, and include new evidence sources.
|
|
39
|
+
- `tidyId`: optional local receipt from a developer-requested `cground tidy TARGET`.
|
|
40
|
+
- `reviews[].maintenance`: optional explicit actions on existing facts, each with `factId`, `action` (`correct`, `merge`, `remove`, or `tighten`), and a source-backed `reason`. `merge` also requires the surviving `replacement` fact key.
|
|
41
|
+
|
|
42
|
+
Every old fact must appear in `reviewedFactIds`, including removed facts. Correct facts stay structurally identical unless explicit maintenance is justified. New facts require separate developer-approved admission. Modified or removed facts must be identified as invalidated. Ordinary updates require changed evidence in a touched path or a changed upstream dependency. Explicit maintenance permits source-verified corrections, merges, removals, and tightening without source drift, within the affected scope or a developer-requested tidy scope. It cannot silently expand into unrelated chapters. Corrections preserve IDs; merges remove the duplicate and require a surviving replacement. All dependent references must be repaired in the same transaction.
|
|
43
|
+
|
|
44
|
+
A maintenance action triggers full dependency review of that chapter, including dependencies of its other facts. If a narrowed `factIds` plan omitted these, rerun `review_plan` for the full chapter and include all required reviews.
|
|
45
|
+
|
|
46
|
+
A related chapter whose facts remain true has an empty invalidation list and unchanged facts. It is reviewed but not rewritten. If all facts remain true, preparation returns `noop: true` and updates only disposable local review snapshots.
|
|
47
|
+
|
|
48
|
+
Preparation validates the entire candidate for every chapter, captures all relevant source snapshots, and fingerprints the registry. Commit also checks snapshots of attested source and documentation files, including files that were missing during review. A new required README invalidates an incomplete request. Commit repeats validation under a writer lock and atomically publishes all changed chapters in one registry replacement. Any changed source or registry invalidates the proposal. Only changed chapters increment revisions and update their source baselines and dependency fact fingerprints.
|
|
49
|
+
|
|
50
|
+
Unchanged reviewed chapters receive local review snapshots, not shared timestamp churn. Other checkouts independently assess their freshness. `evidence-unchanged` is not a semantic guarantee. An ambiguous fact or dependency impact must be resolved with the developer.
|
|
51
|
+
|
|
52
|
+
See `examples/demo-monorepo/demo-data/search-update.json` for a complete two-chapter request: search changes, while the result-list fact remains unchanged.
|
|
53
|
+
|
|
54
|
+
## Session verification and documentation
|
|
55
|
+
|
|
56
|
+
Notes supplement code reading. Verification requires the agent to open source now; remembered statements or matching cached quotes are insufficient. The software checks declarations and hashes, not whether an external agent read or understood a file. It cannot establish semantic truth or automatically identify every point-in-time claim.
|
|
57
|
+
|
|
58
|
+
`review_checklist` discovers source evidence, ancestor/local documentation, child documentation, sibling directory READMEs, and local Markdown document links. It skips generated/vendor paths and never follows symlinks or remote URLs. Discovery is bounded to 10,000 entries per scoped scan and 1,000 documents, with a 2 MB file limit; exceeding limits fails explicitly. Root-level changes include root documentation and immediate child READMEs rather than crawling every subsystem. Follow additional code references and non-Markdown documentation references manually and include those verified files in the request. A checklist is not proof of exhaustive semantic impact.
|
|
59
|
+
|
|
60
|
+
The checklist also accepts no chapter IDs plus touched paths, so README review can proceed when no cached fact is affected. Documentation verification remains mandatory for no-op transactions. A logical chapter is the note to skim in full; sharing one physical JSON registry does not require loading every unrelated pillar into context.
|
|
61
|
+
|
|
62
|
+
## Read-only validation
|
|
63
|
+
|
|
64
|
+
`cground validate [TARGET]` defaults to `all` and accepts the same pillar, chapter and fact selectors as tidy. It checks schema and reference integrity globally, then checks exact evidence, source scope hashes and upstream dependency freshness for the selected facts. Fact validation does not expand to unrelated sibling facts or reverse dependents. Matching local review receipts can acknowledge unchanged assertions after source drift, but evidence quotes must still exist. By default no shared records or review receipts are written; CLI and MCP checks refresh the ignored Markdown export. Stale results list affected pillars, chapters and facts. Accepting cleanup with --cleanup y (CLI) or cleanup:true (MCP) creates a scoped local tidyId, and the calling agent must then perform the complete source review and submit corrections.
|
|
65
|
+
|
|
66
|
+
CLI and MCP operation results show failing rows by default; use `--all-results` or `allResults:true` for passing rows too. The global summary and exit status cover the whole selection even when result rows are paginated. Invalid evidence, unresolved drift, unpopulated chapters and an empty registry yield exit 1. A successful result establishes mechanical consistency, not semantic truth; code and documentation review remain necessary. Cursors reject changes to the registry or validation results.
|
|
67
|
+
|
|
68
|
+
## Developer-requested cleanup
|
|
69
|
+
|
|
70
|
+
`cground tidy all`, `cground tidy PILLAR`, `cground tidy PILLAR/CHAPTER`, or `cground tidy PILLAR/CHAPTER/FACT` generates a plan and local receipt without changing shared records. An unqualified fact ID works only when unambiguous. The reserved target `all` includes every chapter, including disconnected pillars. An empty registry returns no receipt. Fact cleanup expands to its whole chapter and linked chapters; pillar cleanup includes all its chapters and their dependencies/dependents. Follow pagination to see the complete plan. Duplicate hints are lexical suggestions requiring source review, never automatic deletions.
|
|
71
|
+
|
|
72
|
+
The agent performs the work, then submits a complete verified transaction with the `tidyId` and explicit maintenance reasons. The receipt is bound to the registry revision and scope; any shared change requires a new tidy request. MCP `tidy_plan` previews the plan without issuing a receipt; the cground MCP tidy operation issues the same scoped receipt as the CLI. CLI receipts and approval flags record workflow intent, not identity or proof of human authorization against an agent with filesystem access.
|
|
73
|
+
|
|
74
|
+
## Developer-directed operations
|
|
75
|
+
|
|
76
|
+
Agents author the records and can execute approved CLI operations. `approve`, `approve-chapters`, `seed`, `admit`, `accept-facts`, `bootstrap`, `seed-batch`, and `migrate` require explicit developer direction and are also exposed as cground MCP operations with approved:true. An approval flag is a workflow convention, not an identity boundary against a process with filesystem access.
|
|
77
|
+
|
|
78
|
+
`admit` validates the full resulting chapter and all its evidence. Dependent chapters detect changed dependency fact fingerprints; use `review_plan` afterward. Fact dependency changes caused by authorized work can be included in a reviewed transaction; the required reviews cover both the old and new dependency graphs. Moving chapter ownership or moving existing facts between chapters does not yet have a dedicated operator command.
|
|
79
|
+
|
|
80
|
+
Initial setup authorization distinguishes drafting from publication. “Initialize” or “generate a map” produces a draft by default. An explicit request to “initialize and save/publish the map autonomously” delegates initial publication within that scope, without a redundant approval question. The agent still verifies source, refines responsibility boundaries, runs preflight, and reports saved content and coverage gaps. A changed payload requires fresh verification and preflight; it must remain within the delegation or receive new content approval. A boundary-only or draft-only request never authorizes fact publication. This exception is specific to initial setup; ordinary task additions follow the deferred approval workflow.
|
|
81
|
+
|
|
82
|
+
## Bootstrap preflight
|
|
83
|
+
|
|
84
|
+
`cground schema bootstrap` and `cground bootstrap --help --example` expose the combined initial payload: `pillars` plus `batches: [{chapterId, facts}]`. Use `--dry-run` without approval for structural, quote, dependency and source checks. It performs no filesystem writes and returns a content-bound preflight token and tracked file counts per chapter. After content approval of both boundaries and facts, or explicit developer delegation to publish a verified initial map within scope, apply with `--approve --preflight TOKEN`. The registry must still be absent, and every proposed chapter must have a nonempty fact batch. Use boundary-only approve when facts are not ready. The whole batch is published in one atomic replacement under the writer lock, with source and registry rechecks. This is an optimistic filesystem check, not an OS snapshot or proof of semantic verification.
|
|
85
|
+
|
|
86
|
+
For approved empty chapters, `seed-batch` accepts only `batches` and uses the same preflight/apply protocol. Cross-batch dependencies are validated against the full candidate. Nonempty chapters reject seeding. Failed preflights or conflicting publication leave shared knowledge unchanged. Receipts bind the declared publication to content; `approved.declarationOnly:true` and `approved.humanReviewVerified:false` explicitly disclaim proof of human content review. Approval flags remain declarations, not identity checks. Existing boundary-only approval and single-chapter seed/admit commands remain supported.
|
|
87
|
+
|
|
88
|
+
Source scope expansion still rejects scans exceeding 10,000 entries. Source hashing streams regular files without the quotation size cap; evidence extraction retains its 2,000,000-byte limit. Supporting evidence outside ownership participates in validation, task assessment, dependency freshness and review checklists.
|
|
89
|
+
|
|
90
|
+
CLI JSON payloads support `--stdin` or `-`. `cground schema OPERATION` returns the CLI payload schema by default; `--both` also includes the MCP argument schema (seed/admit/propose-facts take a facts array). Mutation operations approve/approve-chapters/seed/admit return counts, changed IDs, validation scope and output path; `--verbose` or MCP `verbose:true` returns the original full object.
|
|
91
|
+
|
|
92
|
+
## Schema v1 migration
|
|
93
|
+
|
|
94
|
+
Run `cground migrate --approve`, then `cground init` to update the managed instructions. Each old pillar becomes a pillar with one `overview` chapter. Facts, source hashes, scope, and revision are preserved; each fact derives its source scope from its evidence paths, and fact dependencies start empty. No dependency relationships are invented. A backup goes to `.common-ground/local/pre-v2-migration.json`. Migration is atomic and idempotent; it does not migrate pending local update proposals.
|
|
95
|
+
|
|
96
|
+
Citation-only repairs may use empty touchedPaths without a tidyId: only evidence may change; the fact ID, statement, sourceScope and dependsOn must remain unchanged. Supply a verified reason, read every required chapter, attest source/documentation verification and the expected revisions. Publication rechecks source and registry conflicts. Use review-plan and review-checklist for the selected chapter; do not invent touched paths.
|
|
97
|
+
|
|
98
|
+
For a chapter owning `src`, keep `sourceScope: ["src"]`. A supporting quote in `shared/config.ts` belongs in `evidence: [{"path":"shared/config.ts","quote":"mode = 1"}]`; external evidence is tracked automatically without expanding chapter ownership.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Quiet maintenance and context use
|
|
2
|
+
|
|
3
|
+
The developer asks for an ordinary coding task. Their agent uses Common Ground as needed, corrects verified existing facts within the affected scope, and mentions meaningful knowledge changes once at completion. There is no autonomous model, watcher, or command capture inside Common Ground. An MCP host still controls its permission prompts.
|
|
4
|
+
|
|
5
|
+
Before bootstrap approval, `task_context start` (or `cground task start`) returns `state: "bootstrap-required"`, the proposal path and a compact next-action object, with no `taskId` and no local task writes. Continue from source, verify boundaries and facts, establish content approval or explicit delegation to publish the initial map within scope, and use `cground bootstrap PLAN.json --dry-run` followed by approval-directed `--approve --preflight TOKEN` for one atomic initial transaction. The separate `cground approve .common-ground/local/bootstrap.json --approve` workflow approves only boundaries; `seed-batch` can populate the approved empty chapters after fact approval. Start again afterward. Do not assess, propose facts or finish without a task ID. If neither registry nor proposal exists, the state is `not-initialized` and the next step is `cground init`. Invalid registries remain errors.
|
|
6
|
+
|
|
7
|
+
## Default: stateless lookup and proportional assessment
|
|
8
|
+
|
|
9
|
+
Use `cground lookup --path PATH` or a short query. Up to five fact statements and source locations are returned, with no source hashing or local writes by default. Freshness is explicitly `not-checked`; `--verify` checks only selected facts and their upstream evidence/source scopes. Verification compares stored source baselines and does not reuse local whole-chapter review receipts. Each compact result contains its fact ID, statement, source paths, relevance and freshness. `--verbose` adds `matchReason`, `matchedPaths`, `matchedTerms`, `unmatchedTerms`, and `queryCoverage` (matched/total terms, or null for path-only lookup). `relevance` distinguishes `ownership-only`, `partial-query`, `weak-match`, and `matched`; these are lexical/path categories, not confidence scores or semantic guarantees. Weak coverage leads with “No direct answer found,” then navigation hints and partial matches. A separate `source-search` suggestion remains unexecuted until the agent chooses to search explicit source paths; its results are labeled live source evidence. See [the source-search guide](../SETUP.md#search-live-source-when-knowledge-is-thin). Matching quotes and hashes still do not establish semantic truth.
|
|
10
|
+
|
|
11
|
+
After editing, use `cground assess --touched PATH1,PATH2` for the task's actual changed paths. Empty paths mean no work; unowned or unchanged source means no fact review. The response includes only focused local/ancestor documentation, without recursively following unrelated documentation links. Source changes return candidate claims to inspect. Missing or unreadable tracked sources require attention, never silent success.
|
|
12
|
+
|
|
13
|
+
If a claim needs correction, `assess --review` returns complete affected/linked chapters, revisions, facts with evidence and source/documentation paths in one paginated package. It also supports verified maintenance when the source is unchanged but an existing claim is wrong. The package identifies each initiating review-scope and its required chapters; prepare unrelated scopes separately. Follow every page and verify source before calling `prepare-patch` without a taskId. Preparation still requires complete reviews; publication still rejects source, documentation and registry conflicts. Report the correction directly; no task start or finish is needed.
|
|
14
|
+
|
|
15
|
+
CLI and both MCP profiles expose `lookup` and `assess` through the cground operation catalog. Existing task workflows remain compatible. Ordinary reads without a task skip cache-context construction; task reads deduplicate source hashes within each request while recomputing them on later requests.
|
|
16
|
+
|
|
17
|
+
## Optional task context
|
|
18
|
+
|
|
19
|
+
1. When deferred additions or aggregate correction reporting are useful, call `task_context` with `action: "start"` and known `paths` or a short `signal`. Keep the returned `taskId` for this task. Do not create a task for every chat message.
|
|
20
|
+
2. Read relevant knowledge with `read_knowledge`. A returned owner already identifies a chapter; an additional pillar-index round trip is optional. Use `kind: "chapter", target: "web-components/search", evidence: true` for complete fact batches, and open their actual source in this session. Ordinary navigation need not read unrelated chapters.
|
|
21
|
+
3. Do the coding work. Call `task_context` with `action: "assess"` and the actual paths this task touched. Include new/deleted files. Do not claim another developer's dirty files. This returns affected chapters and source/documentation paths, or `no-fact-review` with documentation paths. Follow all pages. Path/scope matching cannot detect undeclared semantic connections; follow references found in source.
|
|
22
|
+
4. Before a knowledge edit, read `.common-ground/POLICY.md`, every fact page in each required chapter, and source/README/reference files. `kind: "review"` accepts a chapter or qualified fact ID; `kind: "checklist"` discovers required file paths. Maintenance actions can expand the required scope to other facts in the maintained chapter. The validator reports omitted chapters.
|
|
23
|
+
5. Use `prepare_patch` and `commit_update` for verified corrections. The old full `prepare` CLI and `prepare_update` full-profile tool also work, but only task-associated patches participate in the automatic task completion report.
|
|
24
|
+
6. Queue any worthwhile additions with `propose_facts`. Do not add an inventory entry just because a new component exists. Local library details belong in the library README.
|
|
25
|
+
7. Finish the main task and its checks. Call `task_context` with `action: "finish"`, follow its pages, and consolidate the final response. `notification: "none"` means no Common Ground message is needed. `summary` names committed corrections; `approval-required` includes pending new facts; `attention` includes stale drafts, an uncommitted review, or a correction changed since publication. An unrelated uncertainty is flagged, not turned into unsolicited cleanup.
|
|
26
|
+
|
|
27
|
+
Example completion: “Applied one CI/CD correction: retry limit 2 → 3, verified in ci/build.yml. Recommend keeping it. One new fact is pending approval.” Use real source links and the verified reason for the actual repository. Corrections do not need a second authorization; additions still ask “Ready to make the following facts available to the team?” Never tell the developer to read or hand-edit knowledge.json.
|
|
28
|
+
|
|
29
|
+
`finish` returns only changed facts with before/after fields, the submitted reason, evidence paths, a recommendation, and whether the current record/evidence needs another review. Repeated changes within a task collapse into a net change; reverting to the original fact produces no correction notification. Local receipts from older versions lack this detail and are explicitly flagged for review. This is a presentation aid: exact quotes, freshness and review declarations do not prove semantic truth.
|
|
30
|
+
|
|
31
|
+
Use `cground review [TARGET]` or the MCP `review` operation to compare current knowledge with Git HEAD, including changes made outside this task. `--staged`/`staged:true` selects the Git index. It reports pillar/chapter boundary changes and fact changes; it omits unchanged records, source hashes, revisions and dependency fingerprints. All additions/deletions are explicit, including initial setup. Follow every page. Exact changed evidence quotes are opt-in with `--evidence`/`evidence:true`; otherwise the summary reports changed evidence and its paths. This command never marks anything reviewed, approves it, or writes files. The agent must establish the reason and recommendation from source, not infer them from a diff. Uncertainty blocks approval, not the main task unless relevant.
|
|
32
|
+
|
|
33
|
+
## Compact correction request
|
|
34
|
+
|
|
35
|
+
This example applies to the synthetic demo after changing `SEARCH_MIN_LENGTH` to 3. Replace the sample UUID with the real task ID and verify current revisions and all files before submitting it. Read the unchanged Results chapter in full too.
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"taskId": "00000000-0000-4000-8000-000000000000",
|
|
40
|
+
"chapterId": "web-components/search",
|
|
41
|
+
"factIds": ["search-minimum"],
|
|
42
|
+
"touchedPaths": ["packages/ui/search.ts"],
|
|
43
|
+
"verification": {
|
|
44
|
+
"sourceFiles": ["packages/ui/search.ts", "packages/ui/results.ts"],
|
|
45
|
+
"documentFiles": ["AGENTS.md", "packages/ui/README.md"]
|
|
46
|
+
},
|
|
47
|
+
"reviews": [
|
|
48
|
+
{
|
|
49
|
+
"chapterId": "web-components/search",
|
|
50
|
+
"expectedRevision": 1,
|
|
51
|
+
"reviewedAllFacts": true,
|
|
52
|
+
"reason": "The authorized change raises the verified minimum from 2 to 3.",
|
|
53
|
+
"replacements": [{
|
|
54
|
+
"id": "search-minimum",
|
|
55
|
+
"statement": "The search component exports SEARCH_MIN_LENGTH as 3.",
|
|
56
|
+
"evidence": [{"path": "packages/ui/search.ts", "quote": "export const SEARCH_MIN_LENGTH = 3;"}],
|
|
57
|
+
"sourceScope": ["packages/ui/search.ts"],
|
|
58
|
+
"dependsOn": []
|
|
59
|
+
}]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"chapterId": "web-components/results",
|
|
63
|
+
"expectedRevision": 1,
|
|
64
|
+
"reviewedAllFacts": true,
|
|
65
|
+
"reason": "Read all facts and source; Results still uses the shared threshold."
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Unchanged records are reconstructed server-side. `reviewedAllFacts: true` attests the whole expected revision; it is neither proof of reading nor permission to skip reading. Use `removeFactIds` for deletions. Citation-only repairs may use empty touchedPaths without a tidyId: only evidence may change; the fact ID, statement, sourceScope and dependsOn must remain unchanged. Supply a verified reason, read every required chapter, attest source/documentation verification and the expected revisions. Publication rechecks source and registry conflicts. Use review-plan and review-checklist for the selected chapter; do not invent touched paths.
|
|
72
|
+
|
|
73
|
+
Other explicit maintenance without directly changed evidence needs a reasoned `maintenance` action (`correct`, `merge`, `remove`, or `tighten`) and relevant touched paths, or a developer-requested `tidyId`. See [the record contract](pillar-contract.md) and published `patch.schema.json`.
|
|
74
|
+
|
|
75
|
+
## Deferred additions
|
|
76
|
+
|
|
77
|
+
`propose_facts` takes `taskId`, `chapterId`, and a `facts` array with the existing fact schema. It validates evidence and ownership, and stores drafts under ignored `.common-ground/local/`. Re-proposing the same ID replaces its local draft; it never overwrites a shared fact. Dependencies must already exist in shared knowledge. Stage additions after known corrections to avoid invalidating drafts with those corrections.
|
|
78
|
+
|
|
79
|
+
After finish and explicit developer approval:
|
|
80
|
+
|
|
81
|
+
- Read all pages of `read_knowledge` with `kind: "proposals"` and the task ID.
|
|
82
|
+
- Read all `kind: "proposal-review"` pages for required whole chapters, revisions, sources and documents. Open these files now. If existing facts need correction, resolve that first and reverify/re-propose stale additions in a new task.
|
|
83
|
+
- Have the agent create `REVIEW.json` with `reviews: [{"chapterId": "pillar/chapter", "expectedRevision": 1, "reviewedAllFacts": true}]` for every required chapter, and `verification: {"sourceFiles": [...], "documentFiles": [...]}`.
|
|
84
|
+
- Run `cground accept-facts TASK_ID REVIEW.json --approve`. This validates the entire batch and writes one atomic registry replacement. Only chapters receiving additions increment revisions. It rejects unfinished tasks, uncommitted maintenance, missing reviews, stale drafts and invalid evidence/dependencies.
|
|
85
|
+
|
|
86
|
+
If only some additions are approved, first discard rejected drafts with `cground drop-facts TASK_ID PILLAR/CHAPTER/FACT...`. A flag records developer direction; it cannot prove authorization against an agent with filesystem access. Legacy developer-directed `seed` and `admit` remain available for operator/bootstrap use, but agents must follow this deferred workflow during normal coding tasks.
|
|
87
|
+
|
|
88
|
+
## Context controls and limitations
|
|
89
|
+
|
|
90
|
+
- The default MCP profile has six tools. `--profile full` retains the original thirteen plus cground for compatibility; all CLI workflows are available through MCP.
|
|
91
|
+
- Generated `AGENTS.md` recommends stateless lookup/assessment and carries essential instructions and links to the detailed policy, loaded before edits.
|
|
92
|
+
- Chapter evidence pages have a 12,000-character soft record budget and a 20-record maximum. At least one complete record is returned even if unusually large; evidence and dependencies are never silently cut off. There is no stored fact-count limit.
|
|
93
|
+
- With a task ID, repeated unchanged reads/assessments return a short `unchanged` reference. Reuse it only if the original response is still in the agent's context. Use `refresh: true` to resend after context loss, and a new task for a new agent/session. Source and dependency changes invalidate relevant reuse; documentation changes invalidate checklist/assessment reuse. No live branch/submodule state is cached.
|
|
94
|
+
- Source verification, mandatory correction, full affected-chapter reviews and README checks remain required. Byte reductions do not measure semantic quality or total billed tokens. The engine still parses the full registry and hashes source; huge chapters/dense dependencies remain expensive.
|
|
95
|
+
- `finish` records the task boundary; later code work needs a new task. Stale drafts require re-proposal and a new finish/approval batch. Abandoned local tasks and proposals can be removed after confirming no agent or review still needs them. Do not delete the writer lock while a writer is active.
|
|
96
|
+
- A prepared correction that fails to commit remains visible as attention at finish. If publication succeeds but a later local bookkeeping write fails, inspect the Git diff before retrying or discarding the local receipt; do not claim nothing happened. Common Ground cannot automatically report corrections made through unrelated operator commands or direct file edits.
|
|
97
|
+
|
|
98
|
+
Run `npm run measure:context` to reproduce comparisons of serialized UTF-8 bytes. This measures current full/compact tool definitions, generated entry guidance against the pre-workflow baseline, one corrected record in a synthetic 300-fact chapter, and repeated retrieval. Actual tokenizer, host caching and billing behavior vary.
|
package/docs/releases.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# npm and GitHub Releases distribution
|
|
2
|
+
|
|
3
|
+
Common Ground publishes `@nazty_labs/common-ground` to npm and the same package archive to [GitHub Releases](https://github.com/naztylabs/common-ground/releases). Tag-triggered GitHub Actions checks the package before publishing through npm trusted publishing (OIDC).
|
|
4
|
+
|
|
5
|
+
Consumers still need Node.js 22+ and npm. The archive contains compiled JavaScript and schemas, but not bundled dependencies. npm downloads those dependencies from the configured registry at installation time. Normal runtime operation is local.
|
|
6
|
+
|
|
7
|
+
## 0.5.1
|
|
8
|
+
|
|
9
|
+
This patch addresses feedback from initial setup, build/release lookup and technical format queries:
|
|
10
|
+
|
|
11
|
+
- Short query tokens such as CI require token boundaries, and technical versions such as `1.4` stay intact. Lookup and search downweight repository-wide terms, prioritize distinctive concepts and rank direct evidence-path matches first.
|
|
12
|
+
- Lookup leads weak coverage with “No direct answer found” and separate, bounded chapter/ownership hints from the registry. Compact results show each statement, source list, relevance and freshness once; `--verbose` restores matching diagnostics. Hints remain unverified even with `--verify`; default lookup performs no filesystem scan or knowledge write.
|
|
13
|
+
- A separate `source-search` command and MCP operation provide bounded searches of explicit source paths. Results are labeled live source evidence, with file/line excerpts and scan limits. Weak lookup coverage suggests this fallback without executing it or storing new facts.
|
|
14
|
+
- Initial setup distinguishes draft requests from explicit delegation to save/publish the source-verified initial map. Existing delegation needs no second approval question. Preflight receipts explicitly state they do not prove human content review; source and registry conflict checks remain mandatory.
|
|
15
|
+
- Initialization reports completed, skipped, failed and pending steps. Hook permission failures are advisory; other failures return `INIT_INCOMPLETE` with the underlying error and retry instructions. `init --skip-hook` / MCP `skipHook:true` skips installation. Retries preserve existing knowledge and edited bootstrap drafts.
|
|
16
|
+
- Discovery separates raw signals, responsibility suggestions and rationale. Complete homogeneous subtrees can use directory boundaries; mixed, excluded or truncated trees retain narrower hints. Incomplete ownership is prominent, and delivery prompts cover versions, release triggers, artifacts and publication without inferring facts.
|
|
17
|
+
- A format-architecture review prompt requires several distinct implementation-role filenames and a format specification. It asks about verified relationships, repeated navigation needs and existing ownership before any entry is proposed.
|
|
18
|
+
- START_HERE provides a self-contained bootstrap path and links to detailed maintenance policy, reducing repeated guidance.
|
|
19
|
+
- README introduces the framework and a short agent-led quickstart; the linked, packaged SETUP.md holds detailed commands, workflows, configuration and troubleshooting.
|
|
20
|
+
|
|
21
|
+
Upgrade with the 0.5.1 archive, run `cground refresh-guidance`, and restart the MCP server. Schema-v2 registries remain compatible. Lookup's default response is now compact: consumers needing per-result matching diagnostics must request `verbose:true` or `--verbose`, and navigation kind/freshness live on the shared navigation object. Lookup ranking and discovery candidate paths intentionally change. `check` still establishes mechanical consistency, not exhaustive topic coverage. Synthetic regression tests cover the feedback scenarios through CLI and both MCP profiles.
|
|
22
|
+
|
|
23
|
+
## 0.5.0-beta-2
|
|
24
|
+
|
|
25
|
+
- Lookup explains evidence, source-scope, ownership and query matches, with matched/unmatched terms and explicit lexical coverage limits.
|
|
26
|
+
- CLI errors distinguish missing/unreadable input, malformed JSON, invalid option values, unknown commands, invalid registries and source/registry conflicts. Recovery guidance and affected fields match the failure.
|
|
27
|
+
- Healthy doctor and guidance checks return `next: null`; successful bootstrap suggests lookup with optional task contexts.
|
|
28
|
+
- Guidance refresh reports changed and unchanged files, including idempotent reruns.
|
|
29
|
+
|
|
30
|
+
## 0.5.0-beta-1
|
|
31
|
+
|
|
32
|
+
- Doctor detects outdated managed guidance; `refresh-guidance` updates instructions without changing knowledge, MCP configuration or hooks.
|
|
33
|
+
- Fully reviewed citation-only corrections work without source edits or a tidy request, retaining reason, revision, evidence and publication safeguards.
|
|
34
|
+
- `--json` errors have a stable envelope on stderr with code, message, affected fields and recovery guidance.
|
|
35
|
+
- Fact schemas and help distinguish owned source scope from cross-chapter supporting evidence.
|
|
36
|
+
- Discovery excludes more dependency and editor/agent configuration directories, reports skipped paths, and accepts explicit `scan --exclude PATH1,PATH2` boundaries.
|
|
37
|
+
- Schema output defaults to the CLI payload schema. Use `schema OPERATION --both` (MCP `both:true`) for the additional operation schema.
|
|
38
|
+
|
|
39
|
+
## 0.5.0-beta.0
|
|
40
|
+
|
|
41
|
+
- Stateless lookup returns a few relevant facts and source paths; optional verification checks selected facts and dependencies. Source-aware assessment distinguishes unchanged source from claims needing review, with complete review packages on request.
|
|
42
|
+
- Standalone corrections accept prepare-patch without a task context while retaining full review and publication safeguards. Existing task contexts remain available for deferred additions and aggregate reporting.
|
|
43
|
+
|
|
44
|
+
- CLI schemas, JSON examples and stdin input make setup discoverable without inspecting implementation code.
|
|
45
|
+
- Bootstrap and multi-chapter seeding support no-write preflight, source-file counts and atomic publication guarded by a content token and developer approval.
|
|
46
|
+
- Supporting evidence can cross chapter ownership while remaining tracked for freshness. Source hashing streams large files independently of quotation size limits.
|
|
47
|
+
- Mutation receipts are compact by default; use `--verbose` for full objects. Validation shows failing rows by default; use `--all-results` for passing rows. MCP equivalents are `verbose:true` and `allResults:true`.
|
|
48
|
+
- Discovery recognizes C/C++ projects, skips more vendored trees and prioritizes conventional first-party directories. Setup guidance is shorter and state-specific.
|
|
49
|
+
|
|
50
|
+
Schema-v2 registries remain supported. Integrations that consume full mutation objects or passing validation rows must opt in to the corresponding options. Run `cground init` after upgrading to refresh managed guidance.
|
|
51
|
+
|
|
52
|
+
## 0.4.1-beta.0
|
|
53
|
+
|
|
54
|
+
- `cground review` presents meaningful pillar, chapter, and fact changes against Git HEAD, with staged and structured-output options. When changes exist, the CLI recommends reviewing through a coding agent to verify source and explain what to keep or approve.
|
|
55
|
+
- Task completion gives compact before/after corrections, reasons, source links, and keep/reverify recommendations. Verified corrections are applied before the summary; additions and ownership changes still require developer approval.
|
|
56
|
+
- Init and hook messages direct developers to agent-led review instead of editing the shared JSON.
|
|
57
|
+
|
|
58
|
+
## 0.4.0-beta.0
|
|
59
|
+
|
|
60
|
+
- A complete Markdown reference lives in ignored `.common-ground/local/knowledge.md`, created on init and refreshed by validate, tidy, and shared knowledge updates only when content changes.
|
|
61
|
+
|
|
62
|
+
- `cground validate` checks all knowledge by default, or a selected pillar, chapter, or fact. It preserves shared knowledge, refreshes the local Markdown view, and returns nonzero for invalid, stale, or unpopulated knowledge.
|
|
63
|
+
- `cground tidy all` creates a review scope covering the entire registry without changing facts.
|
|
64
|
+
|
|
65
|
+
- Fact statements allow up to 2,000 characters for conditions, behavior, and consequences, retaining exact evidence requirements. Schema v2 records remain compatible with this version; older clients with the 320-character limit cannot read longer statements.
|
|
66
|
+
- Initialization installs advisory pre-commit checks by default when no existing hook manager owns the entry point. `cground hook mute` and `unmute` control notifications locally without blocking commits or changing facts.
|
|
67
|
+
- Init output is a short summary and review link; `--json` preserves the full response for integrations.
|
|
68
|
+
- Agents explicitly present proposed facts and evidence for team-sharing approval; corrections are summarized in chat with before/after, reasons and source links.
|
|
69
|
+
|
|
70
|
+
## One-time setup
|
|
71
|
+
|
|
72
|
+
1. Commit and push `.github/workflows/release.yml`, the packaging script, and the related project changes before tagging.
|
|
73
|
+
2. Ensure GitHub Actions is enabled for the repository. Repository or organization policy must allow the workflow's `contents: write` permission so it can create a release and upload assets.
|
|
74
|
+
3. Create the package on npm with an initial manual release if it does not exist yet. Run the release checks first, then publish the generated archive with `npm publish ./release/nazty_labs-common-ground-0.5.1.tgz --access public`. Authenticate with your npm account and 2FA. The next automated release must use a new version.
|
|
75
|
+
4. In the npm package settings, add a GitHub Actions trusted publisher: GitHub owner `naztylabs`, repository `common-ground`, workflow filename `release.yml`, and no environment name. Enable direct `npm publish` permission. The npm organization is `nazty_labs`; the GitHub owner is `naztylabs`.
|
|
76
|
+
5. Allow the workflow’s `id-token: write` permission. No npm token secret is needed. GitHub release uploads use the built-in `GITHUB_TOKEN`. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
|
|
77
|
+
|
|
78
|
+
The workflow runs on a GitHub-hosted Ubuntu runner, uses `.nvmrc`, and triggers only for pushed tags beginning with `v`. The tag must exactly equal `v` followed by the version in `package.json`. The versioned commit must contain the workflow.
|
|
79
|
+
|
|
80
|
+
## Build and inspect locally
|
|
81
|
+
|
|
82
|
+
From the repository root:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
nvm use
|
|
86
|
+
npm ci
|
|
87
|
+
npm run release:pack
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This runs tests and the synthetic demo, regenerates the compiled runtime and JSON schemas, and writes these files for the current version:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
release/nazty_labs-common-ground-0.5.1.tgz
|
|
94
|
+
release/nazty_labs-common-ground-0.5.1.tgz.sha256
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Inspect the archive with `tar -tzf release/nazty_labs-common-ground-0.5.1.tgz`. The package includes `dist/`, `schemas/`, documentation, its manifest and license. Repository knowledge, local state, tests, source fixtures, and `node_modules/` are excluded. Local packaging does not publish remotely.
|
|
98
|
+
|
|
99
|
+
## Publish the current version
|
|
100
|
+
|
|
101
|
+
After committing all intended changes, create and push the matching tag:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
git tag -a v0.5.1 -m "Common Ground 0.5.1"
|
|
105
|
+
git push origin v0.5.1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Pushing the tag publishes the release automatically after the checks pass. Follow the **GitHub release** run in the repository's Actions tab. The workflow verifies the installed CLI version, publishes the tested archive to npm, then uploads the archive and checksum and generates release notes. Stable versions use npm’s `latest` tag; prerelease versions use `next`. Versions containing a prerelease suffix, such as `-beta.1`, are marked as prereleases and are not marked Latest.
|
|
109
|
+
|
|
110
|
+
For a subsequent beta, start with a clean working tree and run:
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
npm version prerelease --preid=beta --no-git-tag-version
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This updates `package.json` and `package-lock.json`. The CLI and MCP server read the package version automatically. Update version-specific installation examples, inspect and commit the changes, then tag and push that new version. Do not reuse an already published version or move its tag.
|
|
117
|
+
|
|
118
|
+
If npm publishing succeeds but GitHub release creation fails, finish the GitHub release manually using that run’s version; rerunning cannot republish the same npm version.
|
|
119
|
+
|
|
120
|
+
If validation or packaging fails before release creation, fix the problem and publish a new version, or rerun a failed job if the cause was transient. Release creation intentionally fails when the release already exists; it does not overwrite published assets. If a failed upload leaves a draft, inspect and finish that draft in GitHub instead of expecting a rerun to replace it.
|
|
121
|
+
|
|
122
|
+
## Install a release
|
|
123
|
+
|
|
124
|
+
Download the `.tgz` asset using a browser. GitHub's **Source code (zip)** and **Source code (tar.gz)** downloads are source snapshots, not the built npm package. From the download directory:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
npm install -g ./nazty_labs-common-ground-0.5.1.tgz
|
|
128
|
+
cground --version
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Optionally download the corresponding `.sha256` asset and check it on Linux before installing:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
sha256sum --check nazty_labs-common-ground-0.5.1.tgz.sha256
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
With GitHub CLI installed and, for a private repository, authenticated:
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
gh release download v0.5.1 --repo naztylabs/common-ground \
|
|
141
|
+
--pattern 'nazty_labs-common-ground-0.5.1.tgz*'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Downloading first and installing the local file also avoids npm version differences in permissions for remote tarball URLs. Public release assets can be downloaded without a GitHub account; private repository assets require access.
|
|
145
|
+
|
|
146
|
+
## References
|
|
147
|
+
|
|
148
|
+
- [npm pack](https://docs.npmjs.com/cli/v11/commands/npm-pack)
|
|
149
|
+
- [npm install](https://docs.npmjs.com/cli/v11/commands/npm-install)
|
|
150
|
+
- [GitHub CLI release creation](https://cli.github.com/manual/gh_release_create)
|
|
151
|
+
- [GitHub Actions token permissions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication)
|
|
152
|
+
|
|
153
|
+
Beta 0.3.0 also exposes every CLI workflow through the discoverable `cground` MCP tool in both profiles. Scoped check/validate report affected IDs and offer developer-requested cleanup. The check JSON format now matches validate instead of returning a chapter-status array; automation should read `valid`, `summary`, and `affected`. Cleanup acceptance issues a review plan, not completed fact changes.
|
|
154
|
+
|
|
155
|
+
## 0.4.0-beta.0 developer-experience audit
|
|
156
|
+
|
|
157
|
+
Every command now supports `--help`/`-h`, including task and hook subcommands, without executing it. CLI and MCP use shared operation handlers; check and validate are aliases. Terminal checks are concise; scripts retain JSON and `--json` disables interaction. Unknown/unsupported flags and extra/missing arguments now fail explicitly. Use `cground export` to regenerate the local reference. No new runtime dependency was added. See [the audit](audit-0.4.0.md) for findings, retained tradeoffs, and startup measurements.
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nazty_labs/common-ground",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "An open-source framework for shared, evidence-backed repository knowledge across coding agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/naztylabs/common-ground.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"cground": "dist/cli.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"schemas",
|
|
20
|
+
"README.md",
|
|
21
|
+
"SETUP.md",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"docs"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
31
|
+
"prepack": "npm run schema",
|
|
32
|
+
"demo": "npm run build && node scripts/demo.mjs",
|
|
33
|
+
"schema": "npm run build && node scripts/schema.mjs",
|
|
34
|
+
"release:pack": "npm test && npm run demo && node scripts/release-pack.mjs",
|
|
35
|
+
"measure:context": "npm run build && node scripts/measure-context.mjs"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
39
|
+
"jsonc-parser": "^3.3.1",
|
|
40
|
+
"zod": "^3.25.76"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"typescript": "^5.9.0",
|
|
45
|
+
"zod-to-json-schema": "^3.25.2"
|
|
46
|
+
},
|
|
47
|
+
"contributors": [
|
|
48
|
+
{
|
|
49
|
+
"name": "Nazty Labs"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/admission",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"admission": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"reviews": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"chapterId": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"pattern": "^[a-z0-9][a-z0-9-]*\\/[a-z0-9][a-z0-9-]*$"
|
|
15
|
+
},
|
|
16
|
+
"expectedRevision": {
|
|
17
|
+
"type": "integer",
|
|
18
|
+
"exclusiveMinimum": 0
|
|
19
|
+
},
|
|
20
|
+
"reviewedAllFacts": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"const": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"chapterId",
|
|
27
|
+
"expectedRevision",
|
|
28
|
+
"reviewedAllFacts"
|
|
29
|
+
],
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
},
|
|
32
|
+
"minItems": 1
|
|
33
|
+
},
|
|
34
|
+
"verification": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"sourceFiles": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"allOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"description": "Repository-relative path without traversal or symlinks; trailing directory slashes normalize away."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"documentFiles": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"$ref": "#/definitions/admission/properties/verification/properties/sourceFiles/items"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"required": [
|
|
61
|
+
"sourceFiles",
|
|
62
|
+
"documentFiles"
|
|
63
|
+
],
|
|
64
|
+
"additionalProperties": false
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"reviews",
|
|
69
|
+
"verification"
|
|
70
|
+
],
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
75
|
+
}
|