cadre-ai 3.7.1 → 3.9.0
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +66 -1
- package/README.md +42 -6
- package/agents/cadre-phase-worker.md +5 -1
- package/agents/cadre-task-worker.md +5 -1
- package/dist/cadre-cli.mjs +6 -3
- package/dist/cadre-mcp.mjs +3192 -2079
- package/package.json +1 -1
- package/skills/archive/SKILL.md +18 -4
- package/skills/create/SKILL.md +15 -3
- package/skills/implement/SKILL.md +39 -13
- package/skills/implement/agents/openai.yaml +1 -1
- package/skills/implement/references/conflict-handling.md +1 -1
- package/skills/implement/references/parallel-workers.md +4 -0
- package/skills/implement/references/resume-recovery.md +6 -0
- package/skills/refresh/SKILL.md +28 -5
- package/skills/revert/SKILL.md +20 -2
- package/skills/review/SKILL.md +87 -11
- package/skills/revise/SKILL.md +18 -5
- package/skills/status/SKILL.md +4 -0
- package/skills/track/SKILL.md +19 -9
- package/skills/wisp/SKILL.md +4 -0
- package/templates/v4/init/archive/.gitkeep +1 -0
- package/templates/v4/init/gitignore.template +8 -0
- package/templates/v4/init/guidelines.md +25 -0
- package/templates/v4/init/operations/.gitkeep +1 -0
- package/templates/v4/init/patterns/index.md +8 -0
- package/templates/v4/init/product.md +30 -0
- package/templates/v4/init/project.json +27 -0
- package/templates/v4/init/refreshes/.gitkeep +1 -0
- package/templates/v4/init/styleguides/general.md +14 -0
- package/templates/v4/init/styleguides/language.md +21 -0
- package/templates/v4/init/tech-stack.md +21 -0
- package/templates/v4/init/tracks/.gitkeep +1 -0
- package/templates/v4/init/tracks.md +6 -0
- package/templates/v4/init/wisps/.gitkeep +1 -0
- package/templates/v4/init/workflow.md +91 -0
- package/templates/v4/project/archive-operation.json +19 -0
- package/templates/v4/project/pattern.md +20 -0
- package/templates/v4/project/refresh-operation.json +18 -0
- package/templates/v4/project/refresh.md +21 -0
- package/templates/v4/styleguides/dart.md +27 -0
- package/templates/v4/styleguides/flutter.md +27 -0
- package/templates/v4/styleguides/go.md +29 -0
- package/templates/v4/styleguides/gradle.md +28 -0
- package/templates/v4/styleguides/html-css.md +39 -0
- package/templates/v4/styleguides/index.md +27 -0
- package/templates/v4/styleguides/java.md +27 -0
- package/templates/v4/styleguides/javascript.md +27 -0
- package/templates/v4/styleguides/kotlin.md +26 -0
- package/templates/v4/styleguides/maven.md +28 -0
- package/templates/v4/styleguides/python.md +27 -0
- package/templates/v4/styleguides/react.md +28 -0
- package/templates/v4/styleguides/swift.md +27 -0
- package/templates/v4/styleguides/swiftui.md +27 -0
- package/templates/v4/styleguides/typescript.md +26 -0
- package/templates/v4/track/bug.md +14 -0
- package/templates/v4/track/execution.json +20 -0
- package/templates/v4/track/learning.md +45 -0
- package/templates/v4/track/plan.md +39 -0
- package/templates/v4/track/revert-operation.json +17 -0
- package/templates/v4/track/revise-operation.json +18 -0
- package/templates/v4/track/revision.md +36 -0
- package/templates/v4/track/spec.md +38 -0
- package/templates/v4/track/state.json +31 -0
- package/templates/v5/init/archive/.gitkeep +1 -0
- package/templates/v5/init/gitignore.template +9 -0
- package/templates/v5/init/guidelines.md +25 -0
- package/templates/v5/init/operations/.gitkeep +1 -0
- package/templates/v5/init/patterns/index.md +8 -0
- package/templates/v5/init/product.md +30 -0
- package/templates/v5/init/project.json +27 -0
- package/templates/v5/init/refreshes/.gitkeep +1 -0
- package/templates/v5/init/styleguides/general.md +14 -0
- package/templates/v5/init/styleguides/language.md +21 -0
- package/templates/v5/init/tech-stack.md +21 -0
- package/templates/v5/init/tracks/.gitkeep +1 -0
- package/templates/v5/init/tracks.md +6 -0
- package/templates/v5/init/wisps/.gitkeep +1 -0
- package/templates/v5/init/workflow.md +103 -0
- package/templates/v5/project/archive-operation.json +19 -0
- package/templates/v5/project/pattern.md +20 -0
- package/templates/v5/project/refresh-operation.json +18 -0
- package/templates/v5/project/refresh.md +21 -0
- package/templates/v5/styleguides/dart.md +27 -0
- package/templates/v5/styleguides/flutter.md +27 -0
- package/templates/v5/styleguides/go.md +29 -0
- package/templates/v5/styleguides/gradle.md +28 -0
- package/templates/v5/styleguides/html-css.md +39 -0
- package/templates/v5/styleguides/index.md +27 -0
- package/templates/v5/styleguides/java.md +27 -0
- package/templates/v5/styleguides/javascript.md +27 -0
- package/templates/v5/styleguides/kotlin.md +26 -0
- package/templates/v5/styleguides/maven.md +28 -0
- package/templates/v5/styleguides/python.md +27 -0
- package/templates/v5/styleguides/react.md +28 -0
- package/templates/v5/styleguides/swift.md +27 -0
- package/templates/v5/styleguides/swiftui.md +27 -0
- package/templates/v5/styleguides/typescript.md +26 -0
- package/templates/v5/track/bug.md +14 -0
- package/templates/v5/track/dependency-context.json +9 -0
- package/templates/v5/track/execution.json +21 -0
- package/templates/v5/track/learning.md +45 -0
- package/templates/v5/track/plan.md +42 -0
- package/templates/v5/track/revert-operation.json +17 -0
- package/templates/v5/track/revise-operation.json +18 -0
- package/templates/v5/track/revision.md +36 -0
- package/templates/v5/track/spec.md +38 -0
- package/templates/v5/track/state.json +19 -0
package/skills/revise/SKILL.md
CHANGED
|
@@ -5,6 +5,18 @@ description: Route a requested track change according to lifecycle state, revise
|
|
|
5
5
|
|
|
6
6
|
# Cadre Revise
|
|
7
7
|
|
|
8
|
+
## Cohesive commits and retained context
|
|
9
|
+
|
|
10
|
+
For v5/schema-2 state, each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
|
|
11
|
+
|
|
12
|
+
Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval.
|
|
13
|
+
|
|
14
|
+
Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same token across continuation pages. Clear it after compaction, context loss, expiration, or a fresh task. Keep `knownSources` only for compatibility. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
|
|
15
|
+
|
|
16
|
+
Serialized errors are bounded to 8 KiB. Use `diagnostic_read` with the returned diagnostic ID only when fuller evidence is needed; paginate it. Do not dump cache path lists into conversation. Build outputs belong in the runtime-returned owned `buildCachePath`, never an arbitrary `.cadre/.build-cache` directory.
|
|
17
|
+
|
|
18
|
+
Legacy SHA records and immutable v1–v4 templates remain evidence. Migrate through one approved refresh at a quiescent boundary before creating a v5 execution. Retain each existing execution's original contract and preserve approvals, completed nodes, findings, journals, and archived learning. The v5 commit instructions here replace legacy follow-up provenance commits described below.
|
|
19
|
+
|
|
8
20
|
Read `.cadre/workflow.md`, the full target track, its dependencies, all tracks that depend on it, relevant repository files, and applicable patterns. Read each artifact before editing; never propose a revision from guessed contents.
|
|
9
21
|
|
|
10
22
|
At every required clarification or approval boundary, show a concise impact summary or focused diff. Inspect the active host policy before calling `workflow_elicit`: if the task context reports approval policy `never`, including Codex Full Access, skip the form and ask the same short question once in chat. Otherwise prefer `workflow_elicit`, using `clarification` for at most three questions and `approval` bound to the exact revision proposal checkpoint. Treat only an `approved` result as approval. If it returns `fallback_required`, or immediately returns `declined` while the task explicitly reports policy `never`, ask the same short question once in chat; the latter is policy rejection, not a human decline. Never request secrets or retry the form.
|
|
@@ -22,6 +34,8 @@ Call `project_status` first with `view: "implementation"` and `trackId` for acti
|
|
|
22
34
|
|
|
23
35
|
## Semantic revision procedure
|
|
24
36
|
|
|
37
|
+
Apply the exact approved candidate and reconcile its receipt without another prompt. Changed scope or content requires renewed approval.
|
|
38
|
+
|
|
25
39
|
Expected human decision count is one when the requested change and partial-work disposition can be presented together. A separate preliminary decision is justified only when active work cannot be made safe or fully assessed without first choosing whether to complete, preserve, or revert it.
|
|
26
40
|
|
|
27
41
|
1. Reconcile `state.json.operation`, any execution journal, managed worktrees, workers, the working tree, and recent commits before drafting. Resume a matching `revise` operation from its first incomplete artifact. Observe a safe quiescent boundary before changing an active execution graph; do not stop workers, integrate work, or clean worktrees before the authorization envelope permits the exact disposition. Finish or reconcile any other recorded operation first; never replace it.
|
|
@@ -32,14 +46,13 @@ Expected human decision count is one when the requested change and partial-work
|
|
|
32
46
|
6. Increment revisions exactly once and restore derived manual-verification barriers. A changed plan uses a new execution ID. Do not pass plan Markdown through MCP, validate the stale canonical plan, or create a temporary project copy.
|
|
33
47
|
When appending work after completed track verification, preserve that historical phase's exact title, task IDs, checks, and commit markers and append a new final `Track-level User Manual Verification`. Historical verification depends only on its preceding phases. Candidate inspection uses the intended resulting status for a revision of `ready_for_review`; no pre-approval canonical status change is needed. A staged state must agree with its plan's `targetStatus`, and active execution bindings must still match the reconciled graph.
|
|
34
48
|
7. Call `candidate_inspect` once for every staged revision and cascading artifact. Supply one `planValidations` entry for every staged root or nested `plan.md`, using its exact candidate-relative path and intended resulting track status; omit the list only when the candidate contains no plans. Present every plan result, the target revision, manifest, partial-work disposition, dependent changes, lifecycle transitions, commits, and bookkeeping together, bound to its digest. Partial approval requires a fresh inspection.
|
|
35
|
-
8.
|
|
36
|
-
9.
|
|
37
|
-
10. Call `state_validate` and commit `cadre(revise): update <track-id>`. Reconcile interruption using the workflow journal rules. Record the commit in every revision entry, clear each completed operation, and use a follow-up `cadre(revise): record <track-id>` commit when bookkeeping cannot be part of the artifact commit. These unchanged deterministic consequences remain inside the revision authorization envelope.
|
|
49
|
+
8. Include proposed final states, reassessed dependency-context artifacts, and every cascading change in `candidate_apply` prepare with `workflow: "revise"`. This replaces direct promotion and the separate candidate inspection on the v5 path; `planValidations` remains the legacy inspection interface. Preserve original execution bindings and historical evidence.
|
|
50
|
+
9. Obtain one approval for its exact manifest/digest, then apply the proposal token. Commit `cadre(revise): update <track-id>` with the operation receipt trailers and reconcile. The runtime sets changed spec/plan references before commit and updates the index atomically. Do not write a follow-up record commit or fill the operation's SHA into tracked files.
|
|
38
51
|
|
|
39
52
|
## Memory contract
|
|
40
53
|
|
|
41
|
-
Preserve phase history and existing handoffs. For active v3 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
|
|
54
|
+
Preserve phase history and existing handoffs. For active v3/v4/v5 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
|
|
42
55
|
|
|
43
56
|
## Revision provenance
|
|
44
57
|
|
|
45
|
-
Use `revisions/revision-<id>.md` (including the `revision-` prefix) and include the same path in the approved manifest and operation. Before clearing the revision operation, set `state.commits.spec` and `state.commits.plan` to the revision artifact commit for every spec/plan changed by that commit. Confirm the committed plan has the proposed revisions and graph; a reachable SHA alone is insufficient.
|
|
58
|
+
Use `revisions/revision-<id>.md` (including the `revision-` prefix) and include the same path in the approved manifest and operation. Before clearing the revision operation, set `state.commits.spec` and `state.commits.plan` to the revision artifact commit for every spec/plan changed by that commit. Confirm the committed plan has the proposed revisions and graph; a reachable SHA alone is insufficient. For v5, candidate_apply includes stable operation references in the original approval envelope; reconcile them without a follow-up commit. Do not start delivery with pointers to an older revision. Retain the previous execution binding and handoffs while an approved repair operation owns state.
|
package/skills/status/SKILL.md
CHANGED
|
@@ -22,3 +22,7 @@ Present:
|
|
|
22
22
|
- staged proposal manifests, malformed stages, and canonical candidates awaiting safe cleanup.
|
|
23
23
|
|
|
24
24
|
Read any file before quoting or interpreting it. Do not mutate files, run commits, or silently normalize state.
|
|
25
|
+
|
|
26
|
+
## Bounded reporting
|
|
27
|
+
|
|
28
|
+
This workflow creates no commits. Reuse retained context and the latest mutation receipt when available; status itself is read-only. Report `commit_pending` as unresolved provenance, never as completed delivery. Clear retainedContextToken after context loss. Use diagnostic_read only for explicitly needed full diagnostics; ordinary errors are capped at 8 KiB. Never migrate or normalize historical state from this workflow.
|
package/skills/track/SKILL.md
CHANGED
|
@@ -5,6 +5,18 @@ description: Create or resume a Cadre feature or bug track, including a function
|
|
|
5
5
|
|
|
6
6
|
# Cadre Track
|
|
7
7
|
|
|
8
|
+
## Cohesive commits and retained context
|
|
9
|
+
|
|
10
|
+
For v5/schema-2 state, each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
|
|
11
|
+
|
|
12
|
+
Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval.
|
|
13
|
+
|
|
14
|
+
Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same token across continuation pages. Clear it after compaction, context loss, expiration, or a fresh task. Keep `knownSources` only for compatibility. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
|
|
15
|
+
|
|
16
|
+
Serialized errors are bounded to 8 KiB. Use `diagnostic_read` with the returned diagnostic ID only when fuller evidence is needed; paginate it. Do not dump cache path lists into conversation. Build outputs belong in the runtime-returned owned `buildCachePath`, never an arbitrary `.cadre/.build-cache` directory.
|
|
17
|
+
|
|
18
|
+
Legacy SHA records and immutable v1–v4 templates remain evidence. Migrate through one approved refresh at a quiescent boundary before creating a v5 execution. Retain each existing execution's original contract and preserve approvals, completed nodes, findings, journals, and archived learning. The v5 commit instructions here replace legacy follow-up provenance commits described below.
|
|
19
|
+
|
|
8
20
|
Create only `feature` or `bug` tracks. Resume an existing drafting track instead of replacing it.
|
|
9
21
|
|
|
10
22
|
At every required clarification or approval boundary, show a concise summary or focused diff. Inspect the active host policy before calling `workflow_elicit`: if the task context reports approval policy `never`, including Codex Full Access, skip the form and ask the same short question once in chat. Otherwise prefer `workflow_elicit`, using `clarification` for at most three questions and `approval` bound to the current proposal digest. Treat only an `approved` result as approval. If it returns `fallback_required`, or immediately returns `declined` while the task explicitly reports policy `never`, ask the same short question once in chat; the latter is policy rejection, not a human decline. Never request secrets or retry the form.
|
|
@@ -19,21 +31,19 @@ Call `project_status` first with `view: "project"` for a new track or `view: "tr
|
|
|
19
31
|
|
|
20
32
|
1. Normalize a stable track ID. Look for its state at the status-derived active or archive location. If track state exists, reconcile its operation journal, working tree, and recent commits first. If only `track-<track-id>` candidate state exists, retain its exact files and resume the pre-approval proposal instead of treating it as a track or restarting it. Otherwise determine title, type, goal, scope, dependencies, risks, and unknowns with the human.
|
|
21
33
|
2. Apply the workflow clarification gate before drafting. Ask targeted questions whenever repository evidence and the request do not clearly establish a material choice such as feature versus bug, in/out of scope behavior, affected users/interfaces/data, compatibility or rollout expectations, acceptance measures, dependency tracks, or whether existing behavior must be preserved. Do not silently choose an interpretation.
|
|
22
|
-
3. Call `template_get_many` once for `track/spec`, `track/state`, `track/plan`, and `track/
|
|
34
|
+
3. Call `template_get_many` once for `track/spec`, `track/state`, `track/plan`, `track/learning`, and `track/dependency-context`. Call `candidate_stage_prepare` for `track-<track-id>` with exact `expectedFiles: ["spec.md", "plan.md", "learning.md", "state.json", "dependency-context.json"]`, then write those files beneath the returned stage.
|
|
23
35
|
4. Draft an acyclic phase/task graph from that proposed specification. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Do not pass plan Markdown through MCP, write it into canonical `.cadre/`, or create a temporary project copy for validation.
|
|
24
36
|
5. Build the marked `Pattern Seed` section at the top of `learning.md` from patterns relevant to the proposed spec and plan. Root phases read the seed; other phases read learning from their declared dependency phases. Cite pattern file paths and explain relevance. Do not invent patterns.
|
|
25
|
-
6.
|
|
26
|
-
7.
|
|
37
|
+
6. Draft final `state.json` alongside spec, plan and learning. Assign closely related tasks within one phase a ` - Commit group: <slug>`; preserve each task's dependency, verification and handoff requirements. Group dependencies must be acyclic after collapsing internal edges; independent groups may run in parallel.
|
|
38
|
+
7. Author `dependency-context.json` from every transitive dependency's spec and learning. Record spec/plan revisions, direct dependency IDs, the dependency-graph fingerprint, exact source SHA-256s, and stable constraint IDs with source-linked text. Every source needs an explicit applicability assessment, including no applicable constraints when justified. This curated context is part of the same human approval; never silently summarize away uncertain requirements. An empty dependency set uses the supplied template.
|
|
39
|
+
8. Call `candidate_apply` with `request: {mode: "prepare", projectRoot, candidateId: "track-<track-id>", workflow: "track", files: ["spec.md", "plan.md", "learning.md", "state.json", "dependency-context.json"]}`. It validates graphs, state and memory and generates the final state/index. Present the complete proposed content, manifest, commit groups, dependency coverage, and one combined commit. After approval, call `request: {mode: "apply", proposalToken}`. Commit `cadre(track): plan <track-id>` once with receipt trailers, then reconcile. No direct canonical promotion, separate specification commit, index call, or record-plan commit is needed.
|
|
27
40
|
|
|
28
|
-
For
|
|
41
|
+
For legacy candidates, `candidate_inspect` with exact `planValidations` remains available for diagnostics and the original recovery contract. New tracks use the combined v5 operation.
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
- Journal plus clean tree and matching expected HEAD: record that commit; do not repeat it.
|
|
32
|
-
- Recorded SHA plus dirty bookkeeping: finish the state-record commit.
|
|
33
|
-
- Any mismatch: present it and stop rather than regenerating approved spec, plan, or learning.
|
|
43
|
+
Expected human decision count is one for a clear new track; do not create a specification-only approval prompt.
|
|
34
44
|
|
|
35
45
|
The plan is the execution source of truth. Dependency changes or a modified approved spec require the Cadre revise workflow.
|
|
36
46
|
|
|
37
47
|
## Memory contract
|
|
38
48
|
|
|
39
|
-
Preserve phase history and existing handoffs. For active v3 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
|
|
49
|
+
Preserve phase history and existing handoffs. For active v3/v4/v5 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
|
package/skills/wisp/SKILL.md
CHANGED
|
@@ -16,3 +16,7 @@ When the exploration needs a material clarification and the Cadre MCP is availab
|
|
|
16
16
|
5. If the result should become product work, recommend the Cadre track workflow; do not retroactively mutate Cadre state from the wisp.
|
|
17
17
|
|
|
18
18
|
Wisp bypasses delivery tracking, not safety, repository instructions, or read-before-edit discipline.
|
|
19
|
+
|
|
20
|
+
## Bounded reporting
|
|
21
|
+
|
|
22
|
+
This workflow creates no commits. Reuse retained context and the latest mutation receipt when available; status itself is read-only. Report `commit_pending` as unresolved provenance, never as completed delivery. Clear retainedContextToken after context loss. Use diagnostic_read only for explicitly needed full diagnostics; ordinary errors are capped at 8 KiB. Never migrate or normalize historical state from this workflow.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Engineering Guidelines
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
{{ARCHITECTURE_GUIDANCE}}
|
|
6
|
+
|
|
7
|
+
## Testing strategy
|
|
8
|
+
|
|
9
|
+
{{TEST_STRATEGY}}
|
|
10
|
+
|
|
11
|
+
## Security and privacy
|
|
12
|
+
|
|
13
|
+
{{SECURITY_PRIVACY}}
|
|
14
|
+
|
|
15
|
+
## Reliability and observability
|
|
16
|
+
|
|
17
|
+
{{RELIABILITY_OBSERVABILITY}}
|
|
18
|
+
|
|
19
|
+
## Documentation and compatibility
|
|
20
|
+
|
|
21
|
+
{{DOCUMENTATION_COMPATIBILITY}}
|
|
22
|
+
|
|
23
|
+
## Repository-specific commands
|
|
24
|
+
|
|
25
|
+
{{REPOSITORY_COMMANDS}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Pattern Catalog
|
|
2
|
+
|
|
3
|
+
Patterns are created only by distilling completed, cleanly reviewed tracks during archival.
|
|
4
|
+
|
|
5
|
+
| Pattern | Summary and applicability | Provenance | Supersedes |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
|
|
8
|
+
Keep applicability and supersession explicit. Missing or ambiguous summaries require inspecting the full pattern; a keyword mismatch never proves irrelevance.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Product
|
|
2
|
+
|
|
3
|
+
## Project context
|
|
4
|
+
|
|
5
|
+
- Classification: `{{greenfield|brownfield}}`
|
|
6
|
+
- Evidence: {{CLASSIFICATION_EVIDENCE}}
|
|
7
|
+
|
|
8
|
+
## Name and summary
|
|
9
|
+
|
|
10
|
+
{{PROJECT_NAME_AND_SUMMARY}}
|
|
11
|
+
|
|
12
|
+
## Users and problems
|
|
13
|
+
|
|
14
|
+
{{USERS_AND_PROBLEMS}}
|
|
15
|
+
|
|
16
|
+
## Outcomes and success measures
|
|
17
|
+
|
|
18
|
+
{{OUTCOMES_AND_MEASURES}}
|
|
19
|
+
|
|
20
|
+
## Scope boundaries
|
|
21
|
+
|
|
22
|
+
{{SCOPE_BOUNDARIES}}
|
|
23
|
+
|
|
24
|
+
## Domain language
|
|
25
|
+
|
|
26
|
+
{{DOMAIN_LANGUAGE}}
|
|
27
|
+
|
|
28
|
+
## Open questions
|
|
29
|
+
|
|
30
|
+
{{OPEN_QUESTIONS}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"runtimeVersion": "{{RUNTIME_VERSION}}",
|
|
4
|
+
"templateSetVersion": "{{TEMPLATE_SET_VERSION}}",
|
|
5
|
+
"project": {
|
|
6
|
+
"name": "{{PROJECT_NAME}}",
|
|
7
|
+
"context": "{{greenfield|brownfield}}"
|
|
8
|
+
},
|
|
9
|
+
"setup": {
|
|
10
|
+
"status": "in_progress",
|
|
11
|
+
"checkpoint": "approved",
|
|
12
|
+
"commit": null,
|
|
13
|
+
"artifactProgress": [],
|
|
14
|
+
"operation": {
|
|
15
|
+
"action": "create",
|
|
16
|
+
"baseCommit": "{{BASE_COMMIT_OR_NULL}}",
|
|
17
|
+
"expectedCommit": "cadre(create): initialize project harness",
|
|
18
|
+
"repositoryRoot": "{{PROJECT_ROOT}}",
|
|
19
|
+
"gitDisposition": "{{existing|initialize}}",
|
|
20
|
+
"approvedArtifacts": [],
|
|
21
|
+
"approvedArtifactHashes": [],
|
|
22
|
+
"approvedAt": "{{APPROVED_AT}}"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"lastRefresh": null,
|
|
26
|
+
"history": []
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# General Coding Styleguide
|
|
2
|
+
|
|
3
|
+
- Read every existing file and directly relevant context before editing it.
|
|
4
|
+
- Prefer the smallest cohesive change that satisfies the approved plan task.
|
|
5
|
+
- Preserve established repository conventions unless an approved revision changes them.
|
|
6
|
+
- Make invalid states difficult to represent; validate at boundaries.
|
|
7
|
+
- Handle errors deliberately and keep failure messages actionable.
|
|
8
|
+
- Test externally visible behavior, failure paths, and meaningful edge cases.
|
|
9
|
+
- Keep comments focused on intent and tradeoffs rather than restating code.
|
|
10
|
+
- Avoid unrelated cleanup in delivery commits.
|
|
11
|
+
|
|
12
|
+
## Project-specific additions
|
|
13
|
+
|
|
14
|
+
{{GENERAL_STYLE_ADDITIONS}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# {{LANGUAGE_OR_FRAMEWORK}} Styleguide
|
|
2
|
+
|
|
3
|
+
## Versions and conventions
|
|
4
|
+
|
|
5
|
+
{{VERSIONS_AND_CONVENTIONS}}
|
|
6
|
+
|
|
7
|
+
## Structure and naming
|
|
8
|
+
|
|
9
|
+
{{STRUCTURE_AND_NAMING}}
|
|
10
|
+
|
|
11
|
+
## Error handling and safety
|
|
12
|
+
|
|
13
|
+
{{ERROR_HANDLING_AND_SAFETY}}
|
|
14
|
+
|
|
15
|
+
## Testing and tooling
|
|
16
|
+
|
|
17
|
+
{{TESTING_AND_TOOLING}}
|
|
18
|
+
|
|
19
|
+
## Avoid
|
|
20
|
+
|
|
21
|
+
{{PROJECT_SPECIFIC_ANTI_PATTERNS}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Technology Stack
|
|
2
|
+
|
|
3
|
+
## Runtime and languages
|
|
4
|
+
|
|
5
|
+
{{RUNTIMES_AND_LANGUAGES}}
|
|
6
|
+
|
|
7
|
+
## Frameworks and libraries
|
|
8
|
+
|
|
9
|
+
{{FRAMEWORKS_AND_LIBRARIES}}
|
|
10
|
+
|
|
11
|
+
## Data and infrastructure
|
|
12
|
+
|
|
13
|
+
{{DATA_AND_INFRASTRUCTURE}}
|
|
14
|
+
|
|
15
|
+
## Tooling
|
|
16
|
+
|
|
17
|
+
{{BUILD_TEST_FORMAT_TOOLS}}
|
|
18
|
+
|
|
19
|
+
## Version constraints
|
|
20
|
+
|
|
21
|
+
{{VERSION_CONSTRAINTS}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Cadre Workflow
|
|
2
|
+
|
|
3
|
+
This is the durable project-level Cadre contract. Installed skills supply command procedure; stop and present any conflict with this file.
|
|
4
|
+
|
|
5
|
+
## Authority and project boundaries
|
|
6
|
+
|
|
7
|
+
- The installed Cadre MCP server is the authoritative runtime and immutable template provider.
|
|
8
|
+
- `.cadre/` contains approved mutable context, lifecycle state, and history only. Runtime code and template catalogs stay in the installed plugin.
|
|
9
|
+
- Read every existing artifact and its relevant repository context before editing it. Never reconstruct state or file content from memory.
|
|
10
|
+
- Resolve the exact repository root before mutation. Never create a nested repository or operate outside the approved root.
|
|
11
|
+
- A missing required MCP capability blocks stateful work; do not recreate it with shell or filesystem logic.
|
|
12
|
+
|
|
13
|
+
## Human governance
|
|
14
|
+
|
|
15
|
+
- Semantic content, scope, selection, and material consequences remain proposals until the human explicitly approves them. Explicit policy-v2 Autonomous authorizes verified in-scope review remediation under the approved specification; final clean completion and material scope changes still require human approval.
|
|
16
|
+
- Combine related decisions into one complete authorization envelope when their exact artifacts, focused diffs, consequences, and verification evidence are available together.
|
|
17
|
+
- Named deterministic consequences—validation, indexes, transitions, commits, and provenance—need no additional approval.
|
|
18
|
+
- Changed content, scope, selection, digest, or material consequences require a corrected proposal and approval. Within policy-v2 Autonomous, reassess and re-inspect changed in-scope remediation and bind its exact digest to persisted-mode authorization; never reuse a superseded digest.
|
|
19
|
+
- An MCP `approval_required` result is not approval. Call its adaptive command again in `apply` mode only after the human approves the unchanged digest-bound proposal.
|
|
20
|
+
- Host security permission is separate from Cadre approval and never approves product content, commits, merges, or lifecycle state.
|
|
21
|
+
|
|
22
|
+
## Candidate artifacts
|
|
23
|
+
|
|
24
|
+
- Write unapproved artifact bodies only beneath `<project-root>/.cadre/stage/<candidate-id>/` at their eventual `.cadre/`-relative paths.
|
|
25
|
+
- Never place unapproved files in canonical `.cadre/` and never transport candidate bodies through MCP when a candidate command exists.
|
|
26
|
+
- Inspect the complete exact candidate set before approval. Approval binds its paths and SHA-256 hashes to one digest.
|
|
27
|
+
- Candidate paths must be relative and traversal-free. Stages reject symbolic links, unexpected files, and size-limit violations.
|
|
28
|
+
- After approval, journal the digest and manifest, promote only matching bytes, verify hashes, and retain the stage through commit recording.
|
|
29
|
+
- `.cadre/stage/` is never committed. A changed candidate requires fresh inspection and approval.
|
|
30
|
+
|
|
31
|
+
## Resumability and Git safety
|
|
32
|
+
|
|
33
|
+
- Every multi-step mutation records an operation journal after approval and before canonical writes or Git mutation.
|
|
34
|
+
- On resume, reconcile the journal, candidate hashes, canonical files, Git status, expected commit, and recorded checkpoint. Continue only the first incomplete deterministic step.
|
|
35
|
+
- If an expected commit already exists with the correct base relationship and content, record it instead of repeating it.
|
|
36
|
+
- Stop on any journal, hash, path, worktree, branch, or history mismatch. Never reset, discard, force-delete, rewrite public history, or guess a repair.
|
|
37
|
+
- Use additive Git history and focused Conventional Commits. Do not include unrelated files or runtime-only worktrees.
|
|
38
|
+
- Reuse passing verification while product files, test inputs, and verification policy are unchanged. Cadre-only bookkeeping does not invalidate product verification.
|
|
39
|
+
|
|
40
|
+
## Sources of truth
|
|
41
|
+
|
|
42
|
+
- `spec.md` defines approved scope, requirements, and acceptance criteria.
|
|
43
|
+
- `plan.md` defines phase/task identity, dependencies, verification barriers, completion markers, and commit provenance.
|
|
44
|
+
- Track `state.json` defines identity, lifecycle status, dependencies, revision, checkpoints, active operation, execution pointer, review cycles, and history.
|
|
45
|
+
- Execution journals define live scheduling and provenance; do not duplicate active node state.
|
|
46
|
+
- `project.json` defines project identity plus setup and refresh history; it does not duplicate track records.
|
|
47
|
+
- `tracks.md` is a generated summary. Never hand-edit it or use it as dependency state.
|
|
48
|
+
- Git is implementation history. Completion claims require reachable recorded commits.
|
|
49
|
+
|
|
50
|
+
## Lifecycle and mutation rules
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
drafting-spec -> drafting-plan -> planned -> in_progress -> ready_for_review
|
|
54
|
+
| | | |
|
|
55
|
+
+-- revise ---+-------------+ +-- revise --> in_progress/planned
|
|
56
|
+
| | +-- approved bugs --> in_progress
|
|
57
|
+
+-------------+ +-- clean review --> completed --> archived
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- Only `review` may mark a track `completed`; only `archive` may mark it `archived`.
|
|
61
|
+
- Completed or archived intent changes create successor work rather than rewriting terminal history.
|
|
62
|
+
- Track dependencies are read from track state and must be completed or archived before dependent execution.
|
|
63
|
+
- Every delivery phase ends in a derived `User Manual Verification` barrier. The final phase is the track-level manual-verification barrier.
|
|
64
|
+
- An `implement` invocation authorizes the approved plan under its persisted approval mode. `track` is the default and requires track verification plus ordinary review approval. `phase` additionally pauses at each phase barrier; `governed` adds regular-task and integration decisions. Explicit policy-v2 `autonomous` verifies phases and track, reviews, and implements in-scope remediation until clean, then requires one human completion approval. Parallel scheduling remains the default, with Sequential available independently.
|
|
65
|
+
- Deterministic MCP operations use one call. Approval-aware operations use `prepare`, pause for the human, then `apply` with the unchanged token.
|
|
66
|
+
|
|
67
|
+
## Context reuse
|
|
68
|
+
|
|
69
|
+
- Inspect project status once at command entry using the narrowest applicable view. Use separate full validation only for final mutation gates or diagnostics.
|
|
70
|
+
- Read each required file once and reuse unchanged content by path and Git hash. Continue truncated reads from the first unread line.
|
|
71
|
+
- Fetch known immutable templates in one bundle and retain them through the decision. Do not rediscover known IDs through the catalog.
|
|
72
|
+
- Present concise status and focused diffs. Identify large unchanged defaults by version, path, and hash unless requested.
|
|
73
|
+
|
|
74
|
+
## Durable memory and context
|
|
75
|
+
|
|
76
|
+
- Active Pattern Seeds contain one versioned `cadre:memory` JSON block with spec/plan revisions and safe pattern paths plus SHA-256 hashes. Reassess changed guidance within track/revise/refresh/archive authorization; do not silently refresh hashes without reviewing applicability.
|
|
77
|
+
- Preserve completed and archived learning as historical evidence. Missing old handoffs mean not recorded; never manufacture them during migration.
|
|
78
|
+
- Record bounded decisions, failed approaches, open questions, next action, and source fingerprints alongside task commit/block checkpoints. These handoffs are evidence, never approval or duplicated scheduler state.
|
|
79
|
+
- Use `context_read` for a selected node and consume all pages. It returns full approved scope/plan, applicable project instructions, dependency learning, and persisted handoffs. Read code and repository instructions separately before edits. Reuse hashes only when their source content is still available in the current session.
|
|
80
|
+
- Required context is never silently truncated. Continue pages, restart after snapshot drift, and expand ambiguous sections. Stop dependent execution on stale memory until reassessed.
|
|
81
|
+
- Routine status uses summaries; full history and graph are explicit detail reads. Project pagination filters rows, never validation coverage or counts.
|
|
82
|
+
- An approved refresh is required before delivery with a new runtime/template set. Keep staging, diagnostics, blocking, and verified cleanup available for recovery, preserve history, and resume the existing journal after interruption.
|
|
83
|
+
|
|
84
|
+
## Autonomous review and policy migration
|
|
85
|
+
|
|
86
|
+
- New executions persist `approvalPolicyVersion: 2`. Legacy Autonomous without this version requires an explicit Track-or-Autonomous choice in an approved, digest-bound refresh before continuing or inheriting it. Preserve existing Governed/Phase choices and the Governed fallback for missing modes.
|
|
87
|
+
- Autonomous records `state.autonomousReview`: original execution/authorization, specification commit, initial review baseline, checkpoint, and stable finding identities with distinct remediation execution IDs. The installed review skill defines its exact JSON and review procedure; implement owns execution recovery. Follow MCP `nextStep` to invoke the installed workflow in the same task, after its required bookkeeping commit.
|
|
88
|
+
- Complete implementation and its bookkeeping before review. Review the cumulative initial baseline through the latest completed execution HEAD, not only the latest fix. Stage and inspect remediation, bind its manifest digest to originating authority, journal before promotion, preserve completed phases, and start a fresh execution for the appended graph.
|
|
89
|
+
- Continue while making verified progress. Pause after the same finding survives two remediation attempts, for material scope decisions, or when required verification or external prerequisites are unavailable. Preserve finding identity across code moves; never waive findings or weaken checks to obtain a clean review.
|
|
90
|
+
- Record actual verification separately from persisted-mode authorization; never claim human approval of automated phase or track checks. Prepare clean completion only after all findings are resolved and the latest execution/HEAD has been reviewed. Ask once for the exact final completion proposal, then apply only after explicit human approval. No mode authorizes automatic clean completion.
|
|
91
|
+
- Scope/verification policy changes require renewed human authority. Product changes invalidate the clean-review checkpoint; Cadre bookkeeping alone may reuse unchanged evidence. Resume the recorded review or implementation checkpoint without duplicating findings, phases, attempts, or commits.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"action": "archive",
|
|
4
|
+
"batchId": "archive-{{ARCHIVE_TS}}",
|
|
5
|
+
"status": "in_progress",
|
|
6
|
+
"checkpoint": "approved",
|
|
7
|
+
"baseCommit": "{{BASE_COMMIT}}",
|
|
8
|
+
"expectedCommit": "{{EXPECTED_COMMIT}}",
|
|
9
|
+
"selectedTracks": ["{{TRACK_ID}}"],
|
|
10
|
+
"completedTracks": [],
|
|
11
|
+
"approvedArtifacts": ["{{APPROVED_ARTIFACT}}"],
|
|
12
|
+
"approvalDigest": "{{APPROVAL_DIGEST}}",
|
|
13
|
+
"approvedArtifactHashes": [
|
|
14
|
+
{ "path": "{{APPROVED_ARTIFACT}}", "sha256": "{{ARTIFACT_SHA256}}" }
|
|
15
|
+
],
|
|
16
|
+
"artifactProgress": [],
|
|
17
|
+
"approvedAt": "{{APPROVED_AT}}",
|
|
18
|
+
"archiveCommit": null
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Pattern: {{PATTERN_NAME}}
|
|
2
|
+
|
|
3
|
+
## Use when
|
|
4
|
+
|
|
5
|
+
{{APPLICABILITY}}
|
|
6
|
+
|
|
7
|
+
## Guidance
|
|
8
|
+
|
|
9
|
+
{{GUIDANCE}}
|
|
10
|
+
|
|
11
|
+
## Tradeoffs and limits
|
|
12
|
+
|
|
13
|
+
{{TRADEOFFS}}
|
|
14
|
+
|
|
15
|
+
## Provenance
|
|
16
|
+
|
|
17
|
+
- Track: `{{TRACK_ID}}`
|
|
18
|
+
- Phase/task: `{{PHASE_TASK}}`
|
|
19
|
+
- Commits: {{COMMITS}}
|
|
20
|
+
- Archived at: {{TIMESTAMP}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"action": "refresh",
|
|
4
|
+
"operationId": "refresh-{{REFRESH_TS}}",
|
|
5
|
+
"status": "in_progress",
|
|
6
|
+
"checkpoint": "approved",
|
|
7
|
+
"baseCommit": "{{BASE_COMMIT}}",
|
|
8
|
+
"expectedCommit": "cadre(refresh): update project context",
|
|
9
|
+
"refreshPath": "refreshes/refresh-{{REFRESH_TS}}.md",
|
|
10
|
+
"approvedArtifacts": ["refreshes/refresh-{{REFRESH_TS}}.md"],
|
|
11
|
+
"approvalDigest": "{{APPROVAL_DIGEST}}",
|
|
12
|
+
"approvedArtifactHashes": [
|
|
13
|
+
{ "path": "{{APPROVED_ARTIFACT}}", "sha256": "{{ARTIFACT_SHA256}}" }
|
|
14
|
+
],
|
|
15
|
+
"artifactProgress": [],
|
|
16
|
+
"approvedAt": "{{APPROVED_AT}}",
|
|
17
|
+
"refreshCommit": null
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Refresh {{REFRESH_TS}}
|
|
2
|
+
|
|
3
|
+
- Status: proposed
|
|
4
|
+
- Previous refresh/setup commit: `{{BASE_COMMIT}}`
|
|
5
|
+
- Refresh commit: pending
|
|
6
|
+
|
|
7
|
+
## Inputs and evidence
|
|
8
|
+
|
|
9
|
+
{{INPUTS_AND_COMMIT_RANGE}}
|
|
10
|
+
|
|
11
|
+
## Proposed context changes
|
|
12
|
+
|
|
13
|
+
{{PROPOSED_CHANGES}}
|
|
14
|
+
|
|
15
|
+
## Active-track impact
|
|
16
|
+
|
|
17
|
+
{{TRACK_IMPACT}}
|
|
18
|
+
|
|
19
|
+
## Approval
|
|
20
|
+
|
|
21
|
+
{{APPROVAL_RECORD}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Dart Styleguide
|
|
2
|
+
|
|
3
|
+
Apply `general.md` first and use Effective Dart as the language baseline.
|
|
4
|
+
|
|
5
|
+
## Idiomatic defaults
|
|
6
|
+
|
|
7
|
+
- Format with `dart format`; do not hand-align code against formatter output.
|
|
8
|
+
- Use `UpperCamelCase` for types/extensions, `lowerCamelCase` for other identifiers, and `lowercase_with_underscores` for files/directories/packages.
|
|
9
|
+
- Order `dart:` imports before `package:` imports and relative imports; keep exports in their own section.
|
|
10
|
+
- Prefer concise, readable language features without compressing multiple responsibilities together.
|
|
11
|
+
- Use sound null safety; model absence explicitly and avoid `!` unless an invariant is proven.
|
|
12
|
+
- Choose one consistent local-variable policy for `final`/`var`; favor immutable fields and top-level values.
|
|
13
|
+
- Avoid storing derivable state and expose one source of truth.
|
|
14
|
+
- Use `async`/`await` deliberately; return/await futures, handle stream subscriptions, and propagate useful errors.
|
|
15
|
+
- Design public APIs for clear call sites, consistent terminology, and minimal surprising behavior.
|
|
16
|
+
- Document public APIs with `///` comments and keep implementation comments focused on intent.
|
|
17
|
+
|
|
18
|
+
## Verification
|
|
19
|
+
|
|
20
|
+
- Run `dart format --output=none --set-exit-if-changed .`, `dart analyze`, and `dart test` or project equivalents.
|
|
21
|
+
- Test null/error/async paths and public package APIs.
|
|
22
|
+
|
|
23
|
+
## Sources
|
|
24
|
+
|
|
25
|
+
- [Effective Dart](https://dart.dev/effective-dart)
|
|
26
|
+
- [Effective Dart: Usage](https://dart.dev/effective-dart/usage)
|
|
27
|
+
- [Effective Dart: Design](https://dart.dev/effective-dart/design)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Flutter Styleguide
|
|
2
|
+
|
|
3
|
+
Apply `general.md` and `dart.md` first. Adapt architecture recommendations to the approved app size and existing brownfield structure.
|
|
4
|
+
|
|
5
|
+
## Flutter defaults
|
|
6
|
+
|
|
7
|
+
- Separate UI and data responsibilities. Keep business/data logic out of widget build methods.
|
|
8
|
+
- Give views/widgets presentation responsibility; place UI state/transformation in an approved state-holder or ViewModel pattern.
|
|
9
|
+
- Isolate external data access behind repositories/services with clear interfaces and dependency injection.
|
|
10
|
+
- Use unidirectional data flow and immutable models where practical.
|
|
11
|
+
- Keep widgets small and composable; use `const` constructors whenever inputs are compile-time constants.
|
|
12
|
+
- Keep transient UI state local and lift/share it only when multiple consumers need the same source of truth.
|
|
13
|
+
- Use stable keys where widget identity matters; do not use keys indiscriminately.
|
|
14
|
+
- Model loading, empty, error, offline, and success states explicitly.
|
|
15
|
+
- Build responsive/adaptive layouts from constraints and platform behavior, not device-name checks.
|
|
16
|
+
- Include semantics, keyboard/focus behavior, text scaling, and contrast in Definition of Done.
|
|
17
|
+
|
|
18
|
+
## Verification
|
|
19
|
+
|
|
20
|
+
- Run `dart format`, `flutter analyze`, unit tests for services/repositories/state holders, widget tests for views, and targeted integration tests.
|
|
21
|
+
- Test lifecycle/disposal, navigation, dependency injection, platform differences, golden output when appropriate, and accessibility.
|
|
22
|
+
|
|
23
|
+
## Sources
|
|
24
|
+
|
|
25
|
+
- [Flutter architecture recommendations](https://docs.flutter.dev/app-architecture/recommendations)
|
|
26
|
+
- [Flutter app architecture guide](https://docs.flutter.dev/app-architecture/guide)
|
|
27
|
+
- [Flutter testing](https://docs.flutter.dev/testing/overview)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Go Styleguide
|
|
2
|
+
|
|
3
|
+
Apply `general.md` first. Repository formatter/linter configuration takes precedence when explicitly approved.
|
|
4
|
+
|
|
5
|
+
## Idiomatic defaults
|
|
6
|
+
|
|
7
|
+
- Format all source with `gofmt`; use `goimports` when the project adopts it.
|
|
8
|
+
- Use short, lowercase, single-word package names. Avoid catch-all packages such as `util`, `common`, or `misc`.
|
|
9
|
+
- Keep exported names purposeful; avoid repeating the package name in identifiers.
|
|
10
|
+
- Write doc comments for exported packages, types, functions, methods, and variables. Begin declaration comments with the declared name when natural.
|
|
11
|
+
- Accept interfaces at the consumer boundary and return concrete types unless abstraction is required.
|
|
12
|
+
- Keep interfaces small and define them near their consumers.
|
|
13
|
+
- Handle every error deliberately. Add useful context without obscuring the original error; use `errors.Is`/`errors.As` for semantic checks.
|
|
14
|
+
- Reserve `panic` for unrecoverable programmer/invariant failures, not routine error handling.
|
|
15
|
+
- Pass `context.Context` explicitly as the first parameter for request-scoped cancellation/deadlines; do not store it in structs.
|
|
16
|
+
- Make goroutine ownership, cancellation, and shutdown explicit. Avoid goroutine/channel leaks.
|
|
17
|
+
- Prefer simple control flow, early returns, and zero-value-useful types.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
- Run `gofmt`/`goimports`, `go vet ./...`, and `go test ./...`.
|
|
22
|
+
- Prefer table-driven tests for repeated behavior and include failure/edge cases.
|
|
23
|
+
- Run the race detector for concurrency-sensitive changes when practical.
|
|
24
|
+
|
|
25
|
+
## Sources
|
|
26
|
+
|
|
27
|
+
- [Effective Go](https://go.dev/doc/effective_go)
|
|
28
|
+
- [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments)
|
|
29
|
+
- [Go Doc Comments](https://go.dev/doc/comment)
|