cleargate 0.14.0 → 0.15.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/CHANGELOG.md +16 -0
- package/dist/MANIFEST.json +71 -15
- package/dist/admin-api/index.cjs +0 -1
- package/dist/admin-api/index.js +1 -2
- package/dist/auth/factory.cjs +0 -1
- package/dist/auth/factory.js +2 -3
- package/dist/auth/require-token.cjs +0 -1
- package/dist/auth/require-token.js +1 -2
- package/dist/auth/token-store.cjs +0 -1
- package/dist/auth/token-store.js +1 -2
- package/dist/{bootstrap-root-QKSA5V75.js → bootstrap-root-2H5HVTCC.js} +1 -2
- package/dist/{chunk-PDE37WFQ.js → chunk-A7MSQUU7.js} +2 -3
- package/dist/{chunk-BTSZOEWC.js → chunk-P6KEDAK2.js} +0 -1
- package/dist/{chunk-E3X7IE5E.js → chunk-PY6FHGV5.js} +1 -2
- package/dist/{chunk-5DI2Z3C2.js → chunk-Y53ZZYYU.js} +1 -2
- package/dist/cli.cjs +1564 -1414
- package/dist/cli.js +1514 -1364
- package/dist/lib/ledger.cjs +0 -1
- package/dist/lib/ledger.js +1 -2
- package/dist/lib/lifecycle-reconcile.cjs +0 -1
- package/dist/lib/lifecycle-reconcile.js +2 -3
- package/dist/{whoami-EANGN46Z.js → whoami-JKQQPABQ.js} +3 -4
- package/package.json +4 -3
- package/templates/cleargate-planning/.claude/agents/architect.md +4 -2
- package/templates/cleargate-planning/.claude/agents/developer.md +4 -11
- package/templates/cleargate-planning/.claude/agents/qa.md +14 -6
- package/templates/cleargate-planning/.claude/hooks/pending-task-sentinel.sh +2 -2
- package/templates/cleargate-planning/.claude/skills/sprint-execution/SKILL.md +19 -1
- package/templates/cleargate-planning/.cleargate/config.example.yml +16 -0
- package/templates/cleargate-planning/.cleargate/scripts/close_sprint.deferred-verify.red.node.test.ts +245 -0
- package/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +227 -0
- package/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +5 -4
- package/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +75 -2
- package/templates/cleargate-planning/.cleargate/scripts/pre_gate_common.sh +48 -0
- package/templates/cleargate-planning/.cleargate/scripts/pre_gate_runner.sh +57 -1
- package/templates/cleargate-planning/.cleargate/scripts/provision_worktree_config.sh +155 -0
- package/templates/cleargate-planning/.cleargate/scripts/qa_red_lint.mjs +380 -0
- package/templates/cleargate-planning/.cleargate/scripts/run_script.sh +34 -1
- package/templates/cleargate-planning/.cleargate/scripts/test/cr077_eviction.red.sh +113 -0
- package/templates/cleargate-planning/.cleargate/scripts/test/cr078_init.test.sh +309 -0
- package/templates/cleargate-planning/.cleargate/scripts/test/cr079_provision.red.sh +262 -0
- package/templates/cleargate-planning/.cleargate/scripts/test/cr080_wrapper.test.sh +177 -0
- package/templates/cleargate-planning/.cleargate/scripts/test/cr081_qa_red_lint.red.sh +348 -0
- package/templates/cleargate-planning/.cleargate/sprint-runs/_off-sprint/.session-totals.json +1 -0
- package/templates/cleargate-planning/.cleargate/sprint-runs/_off-sprint/token-ledger.jsonl +27 -0
- package/templates/cleargate-planning/.cleargate/templates/sprint_context.md +17 -0
- package/templates/cleargate-planning/.cleargate/templates/story.md +1 -0
- package/templates/cleargate-planning/MANIFEST.json +71 -15
- package/dist/admin-api/index.cjs.map +0 -1
- package/dist/admin-api/index.js.map +0 -1
- package/dist/auth/factory.cjs.map +0 -1
- package/dist/auth/factory.js.map +0 -1
- package/dist/auth/require-token.cjs.map +0 -1
- package/dist/auth/require-token.js.map +0 -1
- package/dist/auth/token-store.cjs.map +0 -1
- package/dist/auth/token-store.js.map +0 -1
- package/dist/bootstrap-root-QKSA5V75.js.map +0 -1
- package/dist/chunk-5DI2Z3C2.js.map +0 -1
- package/dist/chunk-BTSZOEWC.js.map +0 -1
- package/dist/chunk-E3X7IE5E.js.map +0 -1
- package/dist/chunk-PDE37WFQ.js.map +0 -1
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/lib/ledger.cjs.map +0 -1
- package/dist/lib/ledger.js.map +0 -1
- package/dist/lib/lifecycle-reconcile.cjs.map +0 -1
- package/dist/lib/lifecycle-reconcile.js.map +0 -1
- package/dist/templates/cleargate-planning/.claude/agents/architect-reader.md +0 -61
- package/dist/templates/cleargate-planning/.claude/agents/architect-synth.md +0 -124
- package/dist/templates/cleargate-planning/.claude/agents/architect.md +0 -230
- package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-contradict.md +0 -108
- package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-ingest.md +0 -194
- package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-lint.md +0 -261
- package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-query.md +0 -143
- package/dist/templates/cleargate-planning/.claude/agents/developer.md +0 -185
- package/dist/templates/cleargate-planning/.claude/agents/devops.md +0 -257
- package/dist/templates/cleargate-planning/.claude/agents/qa.md +0 -171
- package/dist/templates/cleargate-planning/.claude/agents/reporter.md +0 -274
- package/dist/templates/cleargate-planning/.claude/hooks/pending-task-sentinel.sh +0 -209
- package/dist/templates/cleargate-planning/.claude/hooks/pre-commit-surface-gate.sh +0 -33
- package/dist/templates/cleargate-planning/.claude/hooks/pre-commit-test-ratchet.sh +0 -58
- package/dist/templates/cleargate-planning/.claude/hooks/pre-commit.sh +0 -19
- package/dist/templates/cleargate-planning/.claude/hooks/pre-edit-gate.sh +0 -162
- package/dist/templates/cleargate-planning/.claude/hooks/pre-tool-use-autonomy.sh +0 -58
- package/dist/templates/cleargate-planning/.claude/hooks/pre-tool-use-task.sh +0 -148
- package/dist/templates/cleargate-planning/.claude/hooks/session-start.sh +0 -75
- package/dist/templates/cleargate-planning/.claude/hooks/stamp-and-gate.sh +0 -43
- package/dist/templates/cleargate-planning/.claude/hooks/token-ledger.sh +0 -590
- package/dist/templates/cleargate-planning/.claude/settings.json +0 -68
- package/dist/templates/cleargate-planning/.claude/skills/flashcard/SKILL.md +0 -102
- package/dist/templates/cleargate-planning/.claude/skills/sprint-execution/SKILL.md +0 -742
- package/dist/templates/cleargate-planning/.cleargate/FLASHCARD.md +0 -7
- package/dist/templates/cleargate-planning/.cleargate/config.example.yml +0 -67
- package/dist/templates/cleargate-planning/.cleargate/config.yml +0 -18
- package/dist/templates/cleargate-planning/.cleargate/delivery/archive/.gitkeep +0 -0
- package/dist/templates/cleargate-planning/.cleargate/delivery/pending-sync/.gitkeep +0 -0
- package/dist/templates/cleargate-planning/.cleargate/knowledge/cleargate-enforcement.md +0 -551
- package/dist/templates/cleargate-planning/.cleargate/knowledge/cleargate-protocol.md +0 -878
- package/dist/templates/cleargate-planning/.cleargate/knowledge/mid-sprint-triage-rubric.md +0 -160
- package/dist/templates/cleargate-planning/.cleargate/knowledge/readiness-gates.md +0 -213
- package/dist/templates/cleargate-planning/.cleargate/knowledge/sprint-closeout-checklist.md +0 -71
- package/dist/templates/cleargate-planning/.cleargate/scripts/_migrate-schema-v3.mjs +0 -120
- package/dist/templates/cleargate-planning/.cleargate/scripts/assert_story_files.mjs +0 -265
- package/dist/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +0 -1012
- package/dist/templates/cleargate-planning/.cleargate/scripts/collision_surface.sh +0 -114
- package/dist/templates/cleargate-planning/.cleargate/scripts/constants.mjs +0 -62
- package/dist/templates/cleargate-planning/.cleargate/scripts/dedupe_frontmatter.mjs +0 -219
- package/dist/templates/cleargate-planning/.cleargate/scripts/file_surface_diff.sh +0 -320
- package/dist/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +0 -15
- package/dist/templates/cleargate-planning/.cleargate/scripts/init_gate_config.sh +0 -38
- package/dist/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +0 -240
- package/dist/templates/cleargate-planning/.cleargate/scripts/launch_wave.mjs +0 -341
- package/dist/templates/cleargate-planning/.cleargate/scripts/lib/report-filename.mjs +0 -54
- package/dist/templates/cleargate-planning/.cleargate/scripts/pre_gate_common.sh +0 -206
- package/dist/templates/cleargate-planning/.cleargate/scripts/pre_gate_runner.sh +0 -371
- package/dist/templates/cleargate-planning/.cleargate/scripts/prefill_report.mjs +0 -280
- package/dist/templates/cleargate-planning/.cleargate/scripts/prep_doc_refresh.mjs +0 -378
- package/dist/templates/cleargate-planning/.cleargate/scripts/prep_qa_context.mjs +0 -888
- package/dist/templates/cleargate-planning/.cleargate/scripts/run_script.sh +0 -209
- package/dist/templates/cleargate-planning/.cleargate/scripts/sprint_trends.mjs +0 -71
- package/dist/templates/cleargate-planning/.cleargate/scripts/state.schema.json +0 -127
- package/dist/templates/cleargate-planning/.cleargate/scripts/suggest_improvements.mjs +0 -717
- package/dist/templates/cleargate-planning/.cleargate/scripts/surface-whitelist.txt +0 -27
- package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_assert_story_files.sh +0 -261
- package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_file_surface.sh +0 -210
- package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_flashcard_gate.sh +0 -190
- package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_prep_qa_context.sh +0 -482
- package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_test_ratchet.sh +0 -327
- package/dist/templates/cleargate-planning/.cleargate/scripts/test_ratchet.mjs +0 -261
- package/dist/templates/cleargate-planning/.cleargate/scripts/update_state.mjs +0 -246
- package/dist/templates/cleargate-planning/.cleargate/scripts/validate_bounce_readiness.mjs +0 -111
- package/dist/templates/cleargate-planning/.cleargate/scripts/validate_state.mjs +0 -184
- package/dist/templates/cleargate-planning/.cleargate/scripts/write_dispatch.sh +0 -172
- package/dist/templates/cleargate-planning/.cleargate/templates/Bug.md +0 -126
- package/dist/templates/cleargate-planning/.cleargate/templates/CR.md +0 -130
- package/dist/templates/cleargate-planning/.cleargate/templates/Sprint Plan Template.md +0 -137
- package/dist/templates/cleargate-planning/.cleargate/templates/epic.md +0 -166
- package/dist/templates/cleargate-planning/.cleargate/templates/hotfix.md +0 -111
- package/dist/templates/cleargate-planning/.cleargate/templates/initiative.md +0 -122
- package/dist/templates/cleargate-planning/.cleargate/templates/sprint_context.md +0 -50
- package/dist/templates/cleargate-planning/.cleargate/templates/sprint_report.md +0 -224
- package/dist/templates/cleargate-planning/.cleargate/templates/story.md +0 -213
- package/dist/templates/cleargate-planning/CLAUDE.md +0 -66
- package/dist/templates/cleargate-planning/MANIFEST.json +0 -503
- package/dist/templates/synthesis/active-sprint.md +0 -30
- package/dist/templates/synthesis/open-gates.md +0 -38
- package/dist/templates/synthesis/product-state.md +0 -31
- package/dist/templates/synthesis/roadmap.md +0 -63
- package/dist/whoami-EANGN46Z.js.map +0 -1
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
<instructions>
|
|
2
|
-
FOLLOW THIS EXACT STRUCTURE. Output sections in order 1-4.
|
|
3
|
-
YAML Frontmatter: Story ID, Parent Epic, Status, Ambiguity, Context Source, Actor, Complexity Label.
|
|
4
|
-
§1 The Spec: User Story + Detailed Requirements + Out of Scope.
|
|
5
|
-
§2 The Truth: Gherkin acceptance criteria + manual verification steps.
|
|
6
|
-
§3 Implementation Guide: Files to modify, technical logic, API contract. Sourced from the approved Epic and verified codebase grounding.
|
|
7
|
-
§4 Quality Gates: Minimum test expectations + Definition of Done checklist.
|
|
8
|
-
Output location: .cleargate/delivery/pending-sync/STORY-{EpicID}-{StoryID}-{StoryName}.md
|
|
9
|
-
|
|
10
|
-
Document Hierarchy Position: LEVEL 2 (Proposal → Epic → Story)
|
|
11
|
-
|
|
12
|
-
Complexity Labels:
|
|
13
|
-
L1: Trivial — Single file, <1hr, known pattern
|
|
14
|
-
L2: Standard — 2-3 files, known pattern, ~2-4hr (default)
|
|
15
|
-
L3: Complex — Cross-cutting, spike may be needed, ~1-2 days
|
|
16
|
-
L4: Uncertain — Requires probing/spiking, >2 days
|
|
17
|
-
|
|
18
|
-
Granularity Rubric (run this check BEFORE emitting a story during epic-decomposition):
|
|
19
|
-
A candidate story is **too small** — file a CR or submit the PR directly — if ANY signal trips:
|
|
20
|
-
• Could this be a config change, a parameter addition, or a one-line edit? If yes, this is not a Story.
|
|
21
|
-
• The change touches one already-existing function/class and the diff fits in <30 LOC.
|
|
22
|
-
• The work amounts to renaming, formatting, or moving without behavior change.
|
|
23
|
-
A candidate story is too big — emit two stories instead, with consecutive IDs (e.g. STORY-007-03 and STORY-007-04, never 03a/03b) — if ANY signal trips:
|
|
24
|
-
• §1.2 Detailed Requirements joins unrelated user goals with "and also" / "additionally".
|
|
25
|
-
• §2.1 Gherkin would need >5 scenarios covering unrelated behaviors.
|
|
26
|
-
• §3.1 Files-to-touch span unrelated subsystems (e.g. API + UI + migration in one story).
|
|
27
|
-
• Complexity would land at L4 (>2 days). L4 is a planning smell — split, or carve out a spike as its own story.
|
|
28
|
-
• `complexity_label: L3` AND `expected_bounce_exposure: high`. L3+high consistently hits developer-agent wall-time limits (observed in SPRINT-09 on STORY-013-02/03/04, all Sonnet 4.6 stream-timeouts). Split into two L2 stories OR escalate the single L3 to Opus at dispatch — the decomposition default is to split.
|
|
29
|
-
Also split the inverse: two candidate stories that each touch the same 1-2 files with overlapping scenarios should merge into one L1/L2.
|
|
30
|
-
At epic-decomposition time there are no remote IDs yet — splits and merges are free. Prefer two focused L1/L2 stories over one L3. Prefer L3 over L4.
|
|
31
|
-
When the rubric is ambiguous, surface the decision to the human as a one-liner ("candidate covers A+B — split into X and Y?") rather than guessing.
|
|
32
|
-
|
|
33
|
-
§0.1 v2 Decomposition Signals:
|
|
34
|
-
`parallel_eligible`: "y" if this story can run concurrently with other stories in the same milestone; "n" if it has a strict predecessor dependency. Default "y". Set by Architect during Sprint Design Review.
|
|
35
|
-
`expected_bounce_exposure`: "low" | "med" | "high" — predicted re-work risk derived from §2.1 scenario count + §3 file-count + ambiguity level. Default "low". Set by Architect. Used by orchestrator to sequence high-exposure stories before low-exposure ones in a v2 sprint to surface risk early.
|
|
36
|
-
`lane`: "standard" | "fast" — Architect-set during Sprint Design Review per the seven-check rubric in cleargate-enforcement.md §9. Default "standard". Absent in pre-EPIC-022 stories means standard per the migration default in update_state.mjs.
|
|
37
|
-
All three fields are v2-only signals. Under v1 sprints they are informational; defaults apply for stories authored before SPRINT-09.
|
|
38
|
-
|
|
39
|
-
POST-WRITE BRIEF
|
|
40
|
-
After Writing this document, render a Brief in chat with the following sections,
|
|
41
|
-
mechanically extracted from the document's own structure:
|
|
42
|
-
|
|
43
|
-
- Prior work ← cleargate-wiki-query result (cite [[IDs]] or write "none found")
|
|
44
|
-
- Summary ← §1.1 User Story
|
|
45
|
-
- Open Questions ← §1.4 Open Questions
|
|
46
|
-
- Edge Cases ← §2.1 Gherkin error scenarios
|
|
47
|
-
- Risks ← §1.5 Risks
|
|
48
|
-
- Ambiguity ← bottom-of-doc ambiguity gate block
|
|
49
|
-
|
|
50
|
-
Halt for human review. When ambiguity reaches 🟢, proceed to call cleargate_push_item.
|
|
51
|
-
Do NOT ask separately for push confirmation — Brief approval covers it.
|
|
52
|
-
|
|
53
|
-
Do NOT output these instructions.
|
|
54
|
-
</instructions>
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
story_id: "STORY-{EpicID}-{StoryID}-{StoryName}"
|
|
58
|
-
parent_epic_ref: "EPIC-{ID}"
|
|
59
|
-
parent_cleargate_id: null # canonical cleargate-id of parent work item; null for top-level
|
|
60
|
-
sprint_cleargate_id: null # canonical cleargate-id of owning sprint; null for off-sprint items
|
|
61
|
-
carry_over: false # set true to skip lifecycle reconciliation at sprint close
|
|
62
|
-
status: "Draft" # lifecycle: Draft → In Review → Completed
|
|
63
|
-
ambiguity: "🔴 High"
|
|
64
|
-
context_source: "approved Epic / verified codebase grounding + recorded direct approval"
|
|
65
|
-
actor: "{Persona Name}"
|
|
66
|
-
complexity_label: "L2"
|
|
67
|
-
parallel_eligible: "y"
|
|
68
|
-
expected_bounce_exposure: "low"
|
|
69
|
-
lane: "standard"
|
|
70
|
-
db_write_set: [] # advisory-v1 (EPIC-033 wave-planner axis 4): list table names this story writes to; default [] = no DB collision contribution; absent treated as [] by architect-synth predicate
|
|
71
|
-
created_at: "2026-04-17T00:00:00Z"
|
|
72
|
-
updated_at: "2026-04-17T00:00:00Z"
|
|
73
|
-
created_at_version: "strategy-phase-pre-init"
|
|
74
|
-
updated_at_version: "strategy-phase-pre-init"
|
|
75
|
-
server_pushed_at_version: null
|
|
76
|
-
draft_tokens:
|
|
77
|
-
input: null
|
|
78
|
-
output: null
|
|
79
|
-
cache_read: null
|
|
80
|
-
cache_creation: null
|
|
81
|
-
model: null
|
|
82
|
-
sessions: []
|
|
83
|
-
cached_gate_result:
|
|
84
|
-
pass: null
|
|
85
|
-
failing_criteria: []
|
|
86
|
-
last_gate_check: null
|
|
87
|
-
# Sync attribution. Optional; stamped by `cleargate push` / `cleargate pull`.
|
|
88
|
-
pushed_by: null # set by push: which user pushed
|
|
89
|
-
pushed_at: null # set by push: ISO-8601 timestamp
|
|
90
|
-
last_pulled_by: null # set by pull: which user pulled
|
|
91
|
-
last_pulled_at: null # set by pull: ISO-8601 timestamp
|
|
92
|
-
last_remote_update: null # set by pull: server's last-modified timestamp
|
|
93
|
-
source: "local-authored" # flips to "remote-authored" on intake
|
|
94
|
-
last_synced_status: null # required for conflict-detector; status at last sync
|
|
95
|
-
last_synced_body_sha: null # sha256 of body at last sync
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
# STORY-{EpicID}-{StoryID}: {Story Name}
|
|
99
|
-
**Complexity:** {L1/L2/L3/L4} — {brief description}
|
|
100
|
-
|
|
101
|
-
## 1. The Spec (The Contract)
|
|
102
|
-
|
|
103
|
-
### 1.1 User Story
|
|
104
|
-
As a {Persona}, I want to {Action}, so that {Benefit}.
|
|
105
|
-
|
|
106
|
-
### 1.2 Detailed Requirements
|
|
107
|
-
- Requirement 1: {Specific behavior}
|
|
108
|
-
- Requirement 2: {Specific data or constraint}
|
|
109
|
-
|
|
110
|
-
### 1.3 Out of Scope
|
|
111
|
-
{What this story explicitly does NOT do.}
|
|
112
|
-
|
|
113
|
-
### 1.4 Open Questions
|
|
114
|
-
|
|
115
|
-
> Resolve every entry before flipping ambiguity to 🟢. Each entry pairs a question with a recommended answer.
|
|
116
|
-
|
|
117
|
-
- **Question:** {edge case, contradiction, or missing detail surfaced during drafting}
|
|
118
|
-
- **Recommended:** {agent's proposed answer}
|
|
119
|
-
- **Human decision:** {populated during Brief review}
|
|
120
|
-
|
|
121
|
-
### 1.5 Risks
|
|
122
|
-
|
|
123
|
-
> Risks specific to this Story (cross-story risks belong in the milestone plan).
|
|
124
|
-
|
|
125
|
-
- **Risk:** {what could go wrong}
|
|
126
|
-
- **Mitigation:** {agent's proposed mitigation}
|
|
127
|
-
|
|
128
|
-
## 2. The Truth (Executable Tests)
|
|
129
|
-
|
|
130
|
-
### 2.1 Acceptance Criteria (Gherkin)
|
|
131
|
-
|
|
132
|
-
```gherkin
|
|
133
|
-
Feature: {Story Name}
|
|
134
|
-
|
|
135
|
-
Scenario: {Happy Path}
|
|
136
|
-
Given {precondition}
|
|
137
|
-
When {user action}
|
|
138
|
-
Then {system response}
|
|
139
|
-
|
|
140
|
-
Scenario: {Edge Case / Error}
|
|
141
|
-
Given {precondition}
|
|
142
|
-
When {invalid action}
|
|
143
|
-
Then {error message}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### 2.2 Verification Steps (Manual)
|
|
147
|
-
- [ ] {e.g., "Verify API returns 200 for valid input"}
|
|
148
|
-
- [ ] {e.g., "Verify UI renders correctly on mobile"}
|
|
149
|
-
|
|
150
|
-
## 3. The Implementation Guide
|
|
151
|
-
|
|
152
|
-
### 3.1 Context & Files
|
|
153
|
-
|
|
154
|
-
> **v2 gate input:** under v2 execution mode, this table is a pre-commit gate input (cleargate-enforcement.md §6). Every file staged in this story's commit must appear in the Value column, or be covered by `.cleargate/scripts/surface-whitelist.txt`. Non-path rows (e.g. "Mirrors", "New Files Needed: Yes/No") are ignored by the parser.
|
|
155
|
-
|
|
156
|
-
| Item | Value |
|
|
157
|
-
|---|---|
|
|
158
|
-
| Primary File | `{filepath/to/main/component.ts}` |
|
|
159
|
-
| Related Files | `{filepath/to/api/service.ts}`, `{filepath/to/types.ts}` |
|
|
160
|
-
| New Files Needed | Yes/No — {Name of file} |
|
|
161
|
-
|
|
162
|
-
### 3.2 Technical Logic
|
|
163
|
-
{Describe the logic flow, e.g., "Use the existing useAuth hook to check permissions."}
|
|
164
|
-
|
|
165
|
-
### 3.3 API Contract (if applicable)
|
|
166
|
-
|
|
167
|
-
| Endpoint | Method | Auth | Request Shape | Response Shape |
|
|
168
|
-
|---|---|---|---|---|
|
|
169
|
-
| `/api/resource` | GET/POST | Bearer/None | `{ id: string }` | `{ status: string }` |
|
|
170
|
-
|
|
171
|
-
## 4. Quality Gates
|
|
172
|
-
|
|
173
|
-
### 4.1 Minimum Test Expectations
|
|
174
|
-
|
|
175
|
-
| Test Type | Minimum Count | Notes |
|
|
176
|
-
|---|---|---|
|
|
177
|
-
| Unit tests | {N} | {e.g., "1 per exported function"} |
|
|
178
|
-
| E2E / acceptance tests | {N} | {e.g., "1 per Gherkin scenario in §2.1"} |
|
|
179
|
-
|
|
180
|
-
### 4.2 Definition of Done (The Gate)
|
|
181
|
-
- [ ] Minimum test expectations (§4.1) met.
|
|
182
|
-
- [ ] All Gherkin scenarios from §2.1 covered.
|
|
183
|
-
- [ ] Peer/Architect Review passed.
|
|
184
|
-
|
|
185
|
-
## Existing Surfaces
|
|
186
|
-
|
|
187
|
-
> L1 reuse audit. List source-tree implementations the request could extend. Cite file:line.
|
|
188
|
-
> Cite paths with at least one '/' separator; root files use './name.ext'. Bare filenames and dotted code references are ignored.
|
|
189
|
-
|
|
190
|
-
- **Surface:** `path/to/file.ext:NN` — {what it does}
|
|
191
|
-
- **Coverage of this requirement:** {≥80% / partial / none — and why}
|
|
192
|
-
|
|
193
|
-
## Why not simpler?
|
|
194
|
-
|
|
195
|
-
> L2 / L3 right-size + justify-complexity. Answer both.
|
|
196
|
-
|
|
197
|
-
- **Smallest existing surface that could carry this:** {citation or "none — net-new abstraction required"}
|
|
198
|
-
- **Why isn't extension / parameterization / config sufficient?** {one paragraph}
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## ClearGate Ambiguity Gate (🟢 / 🟡 / 🔴)
|
|
203
|
-
**Current Status: 🔴 High Ambiguity**
|
|
204
|
-
|
|
205
|
-
*Evaluate each criterion against its literal text. If you substituted an interpretation, leave the box unchecked and surface the substitution in the Brief.*
|
|
206
|
-
|
|
207
|
-
Requirements to pass to Green (Ready for Execution):
|
|
208
|
-
- [ ] Gherkin scenarios completely cover all detailed requirements in §1.2.
|
|
209
|
-
- [ ] Implementation Guide (§3) maps to specific, verified file paths from the approved Epic and verified codebase grounding.
|
|
210
|
-
- [ ] No "TBDs" exist anywhere in the specification or technical logic.
|
|
211
|
-
- [ ] Existing Surfaces cites at least one source-tree path or explicitly states "none — net-new."
|
|
212
|
-
- [ ] Why not simpler? has both sub-bullets answered (no "TBD" / no "{}").
|
|
213
|
-
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# ClearGate — Injected CLAUDE.md Block
|
|
2
|
-
|
|
3
|
-
This file is the content `cleargate init` injects into a downstream user's `CLAUDE.md` between bounded markers. If the user has no existing `CLAUDE.md`, init writes this as a standalone file wrapped with the markers. If one already exists, init appends the bounded block below without touching the user's existing content. Re-running `cleargate init` updates the block in place.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<!-- CLEARGATE:START -->
|
|
8
|
-
## 🔄 ClearGate Planning Framework
|
|
9
|
-
|
|
10
|
-
This repository uses **ClearGate** — a standalone planning framework for AI coding agents. ClearGate scaffolds *how work is planned* (initiatives → epics → stories → sprints) and defines a five-agent loop for execution (Architect, Developer, QA, DevOps, Reporter). ClearGate does not run builds, tests, or deployments; execution tooling remains the target repo's own.
|
|
11
|
-
|
|
12
|
-
**Session-start orientation (read in this order):**
|
|
13
|
-
1. `.cleargate/wiki/index.md` — compiled awareness layer (~3k tokens). Lists active sprint, in-flight items, recent shipments, open gates, planned work, and topic synthesis pages. **Read this first** to know what exists before grepping raw files. If absent, run `cleargate wiki build`. The wiki compiles epics, sprints, proposals, crs, bugs, and initiatives — **stories are excluded by default** (`wiki.ingest_buckets` in `.cleargate/config.yml` omits `stories`; they are too granular for the awareness layer). Stories still sync to ClearGate via `cleargate push`; to see a story, read its raw file under `.cleargate/delivery/**` or pull it from ClearGate. Re-add `stories` to `ingest_buckets` if you want per-story wiki pages.
|
|
14
|
-
2. `.cleargate/knowledge/cleargate-protocol.md` — delivery protocol (non-negotiable rules).
|
|
15
|
-
3. `.cleargate/FLASHCARD.md` — lessons tagged by topic (`#schema`, `#auth`, etc.). Grep for your area before starting.
|
|
16
|
-
4. `.cleargate/knowledge/cleargate-enforcement.md` — hook-enforced rules (worktree mechanics, file-surface contract, lifecycle reconciler, lane rubric, doctor exit codes, etc.). Read only when a CLI hook surfaces an error or when triaging a v2-mode question.
|
|
17
|
-
|
|
18
|
-
**Triage first, draft second.** Every user request gets classified (Epic / Story / CR / Bug / Pull / Push) *before* any drafting. If the type is ambiguous, ask ONE targeted question — do not guess.
|
|
19
|
-
|
|
20
|
-
**Sprint execution.** When a sprint is active, the orchestration playbook lives at `.claude/skills/sprint-execution/SKILL.md` — load it before dispatching any execution agent (Architect / Developer / QA / DevOps / Reporter). The skill is the canonical sprint-loop spec (Architect → QA-Red → Developer → QA-Verify → Reporter, with DevOps for merge/teardown); the always-on CLAUDE.md keeps only the halt-rules and the load-skill contract.
|
|
21
|
-
|
|
22
|
-
**Skill auto-load directive.** When the SessionStart banner emits `Load skill: <name>`, invoke the Skill tool to load it before continuing. Claude Code's description-match auto-load is advisory; this rule is the contract.
|
|
23
|
-
|
|
24
|
-
**Codebase is source of truth.** Wiki, memory, and `context_source` are derived caches. On conflict between cache and code, the code wins; the cache rebuilds. Before stating that a capability exists or doesn't exist, grep the code.
|
|
25
|
-
|
|
26
|
-
**Duplicate check before drafting.** Before Writing any new file under `.cleargate/delivery/pending-sync/`, dispatch the `cleargate-wiki-query` subagent with the request topic. Record the result (`[[IDs]]` of related prior work, or `none found`) on a `Prior work:` line in the Brief — this is auditable evidence the check ran. Then grep `.cleargate/delivery/archive/` + `.cleargate/FLASHCARD.md` for residual hits the wiki may have missed (raw items not yet ingested). If the request names an integration, feature, or capability, also grep the source tree for existing implementations and cite findings in `## Existing Surfaces`. If you find overlap, surface it as a one-liner (*"This is very close to STORY-003-05 shipped in SPRINT-01 — are you extending it or redoing it?"*) before drafting.
|
|
27
|
-
|
|
28
|
-
**Halt at gates.** You halt at Gate 1 (Initiative approval) and Gate 2 (Ambiguity resolution) and wait for explicit human sign-off. You never call `cleargate_push_item` without `approved: true` (hard reject) and explicit human confirmation. Readiness gates (`cached_gate_result.pass`) are advisory by default — the push proceeds and the item body receives an `[advisory: gate_failed — <criteria>]` prefix; opt into hard-reject via `STRICT_PUSH_GATES=true` on the MCP server.
|
|
29
|
-
|
|
30
|
-
**Ambiguity Gate criteria are evaluated literally.** Each `[ ]` box in a work-item's Ambiguity Gate footer must be evaluated against the literal criterion text, not against your interpretation of its intent. If a criterion is not met but you believe the human's intent is satisfied, leave the box unchecked, say so explicitly in the Brief, and ask. Do not substitute "in spirit" satisfaction for literal satisfaction. The gate exists specifically to catch the case where you are about to declare 🟢 by interpretive leap.
|
|
31
|
-
|
|
32
|
-
**Brief is the universal pre-push handshake.** Every work-item template's `<instructions>` block tells you to render a Brief in chat after Writing the document — Summary / Open Questions / Edge Cases / Risks / Ambiguity. Halt for human review. When ambiguity reaches 🟢, push via `cleargate_push_item` automatically — the same approval covers Gate 1 and the push.
|
|
33
|
-
|
|
34
|
-
**Boundary gates (CR-017).** `cleargate sprint init` runs the decomposition gate; `close_sprint.mjs` runs the lifecycle reconciler. Both block in v2.
|
|
35
|
-
|
|
36
|
-
**Sprint close is Gate-4-class (CR-019).** Run `close_sprint.mjs` with no flags first; surface the prompt verbatim; halt. Never pass `--assume-ack` autonomously. Pre-close enforces Steps 2.7 (no leftover worktrees) + 2.8 (sprint branch merged to main) under v2; failure halts close. Post-close prints a 6-item handoff list (Step 8) summarizing commits, merge state, wiki ingest, flashcards, artifacts, and next-sprint preflight.
|
|
37
|
-
|
|
38
|
-
**Drafting work items:**
|
|
39
|
-
- Use the templates in `.cleargate/templates/` (`epic.md`, `story.md`, `CR.md`, `Bug.md`, `Sprint Plan Template.md`, `initiative.md`).
|
|
40
|
-
- Save drafts to `.cleargate/delivery/pending-sync/{TYPE}-{ID}-{Name}.md`.
|
|
41
|
-
- After `cleargate_push_item` returns a Remote ID, update the frontmatter AND move the file to `.cleargate/delivery/archive/` — these two happen atomically, never one without the other.
|
|
42
|
-
- **Story granularity.** When decomposing an epic into stories, run the Granularity Rubric at the top of `story.md`. If a candidate story trips any signal (unrelated goals joined, >5 Gherkin scenarios, subsystems span, L4 complexity), emit two stories with consecutive IDs instead. Splits and merges are free at decomposition time — no remote IDs exist yet.
|
|
43
|
-
|
|
44
|
-
**Initiative Intake.** Stakeholder input arrives via two paths: (1) MCP pull — call `cleargate_pull_initiative` with the remote ID; the tool writes `pending-sync/INITIATIVE-NNN_*.md` automatically; read the result and present a Brief. (2) Manual paste — human pastes the text; triage it, write `pending-sync/INITIATIVE-NNN_*.md` using `templates/initiative.md`, present a Brief. In both cases, after Gate 1 the file moves to `archive/` stamped with `triaged_at:` and `spawned_items:`.
|
|
45
|
-
|
|
46
|
-
**State-aware surface.** At session start, `cleargate doctor --session-start` (invoked by the SessionStart hook) emits one banner line before any other output: `ClearGate state: pre-member — local planning enabled, sync requires join.` OR `ClearGate state: member (project: <project_id>) — full surface enabled.` In **pre-member** state (no valid join token on disk), only local-planning commands are reachable: `init`, `join`, `whoami`, `wiki *`, `gate *`, `stamp`, `doctor`, `scaffold-lint`, `sprint *`, `story *`, `state *`, `upgrade`, `uninstall`. Commands `push`, `pull`, `sync`, `sync-log`, `conflicts`, and `admin *` (except `admin login`) require membership and exit 2 with a redirect: `Run: cleargate join <invite-url>`. If the SessionStart banner says `pre-member`, do not suggest push/pull/sync to the user — instead ask for an invite URL and direct them to `cleargate join`.
|
|
47
|
-
|
|
48
|
-
**Conversational style.** Keep replies terse. Details live in the work-item file and `REPORT.md`, not in chat. State results and next steps; skip narration of your own thought process. After Writing or Editing any file under `.cleargate/delivery/**`, briefly note the ingest result if the PostToolUse hook surfaced one — one short sentence (`✅ ingested as <bucket>/<id>.md` / `⚠️ gate failed: <criterion>` / `🔴 ingest error — see .cleargate/hook-log/gate-check.log`). Do not narrate when nothing fired (skip-excluded paths). This is conversational confirmation, not retry logic.
|
|
49
|
-
|
|
50
|
-
**Support infrastructure.** Flashcard protocol: `.claude/skills/flashcard/SKILL.md`. Token-ledger hook: `.claude/hooks/token-ledger.sh`, wired via `.claude/settings.json` (SubagentStop) — auto-logs agent cost per sprint for the Reporter.
|
|
51
|
-
|
|
52
|
-
**Cross-project orchestration.** When running an orchestrator from one project's repo against another project's sprint tree, export `ORCHESTRATOR_PROJECT_DIR=/absolute/path/to/target/repo` in the shell before launching the session. Overrides `CLAUDE_PROJECT_DIR`; sentinel + ledger writes route into the target's `.cleargate/sprint-runs/` tree. If the target has no `.cleargate/sprint-runs/.active` sentinel, writes land in the target's `_off-sprint` bucket — not the orchestrator's own repo.
|
|
53
|
-
|
|
54
|
-
**Codebase / PM-Tool Boundary (EPIC-027).** `cleargate-cli/src/**` and `.claude/**` MUST NOT import any PM-tool SDK (`@linear/sdk`, `jira-client`, `azure-devops`, `@atlassian/`, `linear-sdk`, `node-jira-client`, `jira.js`). PM-tool adapters live exclusively in `mcp/src/adapters/`; PM-tool credentials are held **server-side on the MCP server**, never in `cleargate-cli` or `.claude/` (today a single `LINEAR_API_KEY` env var; per-project credential rows are roadmap). The adapter surface is **pull-only** today (`pullItem`/`listUpdates`/`pullComments`/`detectNewItems`); `cleargate push` lands work items in the MCP server's store and does **not** write out to the PM tool. The type-and-payload contract (open-type validator, KNOWN_TYPES, RESERVED_PAYLOAD_KEYS, `payload.origin`, `cleargate_id` formats, L1 errorCode + L2 warningCode taxonomies) is fully documented in `.cleargate/knowledge/cleargate-protocol.md` §Type & Payload Contract and §Codebase/PM-Tool Boundary. CI enforcement: `npm run check:no-pm-sdk` (exits non-zero on any forbidden import). Target repos that ran `cleargate init` before SPRINT-27 should re-run `cleargate init` to pick up this boundary rule in their local bounded block.
|
|
55
|
-
|
|
56
|
-
**Single test runner (EPIC-028).** All three packages (mcp/, cleargate-cli/, admin/) use node:test exclusively — vitest is fully eliminated as of 2026-05-18. File naming: `*.node.test.ts`. Run via `tsx --test` (mcp/, cleargate-cli/) or `node --conditions browser --import tsx tests/run-tests.mjs` (admin/). The `--conditions browser` flag is required for admin/ — it enables jsdom-bootstrap via `setup-node-test.mjs`. Adding vitest back is forbidden; `check:no-vitest` pre-commit guard enforces this.
|
|
57
|
-
|
|
58
|
-
**Project overrides.** Content OUTSIDE this `<!-- CLEARGATE:START -->...<!-- CLEARGATE:END -->` block takes precedence where it conflicts with ClearGate defaults.
|
|
59
|
-
|
|
60
|
-
**Scope reminder.** ClearGate is a *planning* framework. It scaffolds how work gets planned and how the five-agent loop runs. It does not replace your project's build system, CI, test runner, or deployment tooling.
|
|
61
|
-
|
|
62
|
-
**Guardrails for the conversational agent:**
|
|
63
|
-
- Sprint close requires explicit human ack. Run close_sprint.mjs without flags first; surface the "re-run with --assume-ack" prompt verbatim and halt. Never pass --assume-ack yourself — that flag is reserved for automated tests.
|
|
64
|
-
|
|
65
|
-
**Doc & metadata refresh on close.** During Gate 4 ack, read `.cleargate/sprint-runs/<id>/.doc-refresh-checklist.md` (generated by `prep_doc_refresh.mjs`) and apply or punt each `- [ ]` item per the canonical list at `.cleargate/knowledge/sprint-closeout-checklist.md`. Items already marked `- [x]` indicate "no changes detected, skip."
|
|
66
|
-
<!-- CLEARGATE:END -->
|