Skip to content

Commit 2e644f6

Browse files
committed
feat: scaffold protocol docs for mission stacks
• [MSN] No active missions on the board • [EXC] Board idle, no stories queued or active • [HLT] 2 warnings, no structural errors detected
1 parent 65af71b commit 2e644f6

10 files changed

Lines changed: 87 additions & 4 deletions

File tree

crates/keel-cli/src/cli/commands/setup/new.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct FoundationalDocSpec {
3535
template: &'static str,
3636
}
3737

38-
const FOUNDATIONAL_DOCS: [FoundationalDocSpec; 9] = [
38+
const FOUNDATIONAL_DOCS: [FoundationalDocSpec; 10] = [
3939
FoundationalDocSpec {
4040
path: "CONSTITUTION.md",
4141
description: "collaboration philosophy and decision hierarchy",
@@ -51,6 +51,11 @@ const FOUNDATIONAL_DOCS: [FoundationalDocSpec; 9] = [
5151
description: "system map, boundaries, and technical seams",
5252
template: templates::project::ARCHITECTURE,
5353
},
54+
FoundationalDocSpec {
55+
path: "PROTOCOL.md",
56+
description: "coordination protocol and data contracts, including Mission Stack rules",
57+
template: templates::project::PROTOCOL,
58+
},
5459
FoundationalDocSpec {
5560
path: "USER_GUIDE.md",
5661
description: "operator-visible product story and workflow guidance",
@@ -515,6 +520,7 @@ mod tests {
515520
assert!(root.join("keel.toml").is_file());
516521
assert!(root.join("AGENTS.md").is_file());
517522
assert!(root.join("INSTRUCTIONS.md").is_file());
523+
assert!(root.join("PROTOCOL.md").is_file());
518524
assert!(root.join("GEMINI.md").is_file());
519525
assert!(root.join("CLAUDE.md").is_file());
520526
assert!(report.initialized_git);

crates/keel-core/src/infrastructure/templates.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ pub mod project {
8787
pub const POLICY: &str = include_str!("../../../../templates/project/POLICY.md");
8888
/// Project architecture template
8989
pub const ARCHITECTURE: &str = include_str!("../../../../templates/project/ARCHITECTURE.md");
90+
/// Project protocol template
91+
pub const PROTOCOL: &str = include_str!("../../../../templates/project/PROTOCOL.md");
9092
/// Project user guide template
9193
pub const USER_GUIDE: &str = include_str!("../../../../templates/project/USER_GUIDE.md");
9294
/// Project agents template
@@ -291,6 +293,13 @@ mod tests {
291293
assert!(project::AGENTS.contains("downstream from Keel"));
292294
}
293295

296+
#[test]
297+
fn project_protocol_template_makes_mission_stack_formal() {
298+
assert!(project::PROTOCOL.contains("Mission Stacks are a formal Keel protocol"));
299+
assert!(project::PROTOCOL.contains("stack/<id>"));
300+
assert!(project::PROTOCOL.contains("managed worktree"));
301+
}
302+
294303
#[test]
295304
fn project_keel_toml_template_exposes_workflow_defaults() {
296305
assert!(project::KEEL_TOML.contains("board_dir = \"{{board_dir}}\""));

templates/project/AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This repository uses Keel as its project-management engine. This file is downstr
1212

1313
1. `INSTRUCTIONS.md` for the repo's procedural turn loop.
1414
2. `POLICY.md` for local operational invariants.
15-
3. `ARCHITECTURE.md` and `USER_GUIDE.md` for product and system context.
15+
3. `ARCHITECTURE.md`, `PROTOCOL.md`, and `USER_GUIDE.md` for system, coordination, and product context.
1616
4. `CODE_WALKTHROUGH.md` for source layout and key abstractions.
1717
5. `keel turn`, `keel mission next --status`, and `keel doctor --status` for the live board state.
1818

@@ -21,6 +21,7 @@ This repository uses Keel as its project-management engine. This file is downstr
2121
- Use Keel as the canonical planning and lifecycle surface.
2222
- Prefer explicit proof over chat-only claims.
2323
- Close loop debt with sealing commits instead of leaving dirty work behind.
24+
- Treat Mission Stack coordination as a formal protocol defined in `PROTOCOL.md`, not as ad hoc repo folklore.
2425
- Escalate only when the work requires human product, design, legal, or operational judgment.
2526

2627
## Decision Resolution Hierarchy
@@ -40,6 +41,7 @@ These define the constraints and workflow of the {{project_name}} environment:
4041
- `POLICY.md` — Operational invariants and engine constraints.
4142
- `CONSTITUTION.md` — Collaboration philosophy and decision hierarchy.
4243
- `ARCHITECTURE.md` — Implementation architecture and technical boundaries.
44+
- `PROTOCOL.md` — Coordination protocol and data contracts, including Mission Stack rules.
4345
- `CODE_WALKTHROUGH.md` — Source layout, key abstractions, and data-flow orientation.
4446
- `USER_GUIDE.md` — Operator-visible product story and workflow guidance.
4547
- `.keel/adrs/` — Binding architecture decisions.

templates/project/ARCHITECTURE.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# {{project_name}} Architecture
22

3-
This document is downstream from Keel and should describe the actual technical shape of {{project_name}}. Keel owns the board engine; this file should explain the repo, runtime, and technical seams that agents need to understand before they change behavior.
3+
This document is downstream from Keel and should describe the actual technical shape of {{project_name}}. Keel owns the board engine; this file should explain the repo, runtime, and technical seams that agents need to understand before they change behavior. Protocol-level coordination rules, including Mission Stack behavior, belong in `PROTOCOL.md`.
44

55
## System Map
66

@@ -25,8 +25,15 @@ Document the major components and their responsibilities.
2525
- Which modules should remain thin?
2626
- Which dependencies or abstractions are intentionally avoided?
2727

28+
## Protocol Boundaries
29+
30+
- Where do external or Mission Stack requests enter the system?
31+
- Where is repo-local board authority enforced?
32+
- Which surfaces validate or emit stack handoffs, receipts, acknowledgments, or managed-worktree rules?
33+
2834
## Operational Seams
2935

3036
- Note the verification surfaces that matter in this repo.
3137
- Note any architecture decisions enforced by ADRs.
3238
- Note any areas where future agents should be especially conservative.
39+
- Note how formal protocol surfaces intersect with runtime or delivery code.

templates/project/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Before doing work, read:
1010
2. `INSTRUCTIONS.md`
1111
3. `POLICY.md`
1212
4. `ARCHITECTURE.md`
13+
5. `PROTOCOL.md`
1314

1415
Those files are the repo-wide operating contract. This file should stay thin and only capture Claude-specific harness notes.
1516

templates/project/CODE_WALKTHROUGH.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# {{project_name}} Code Walkthrough
22

3-
This document orients contributors and agents to the source layout, key abstractions, and data flows in the {{project_name}} codebase. For governance philosophy see [CONSTITUTION.md](CONSTITUTION.md); for architectural contracts see [ARCHITECTURE.md](ARCHITECTURE.md).
3+
This document orients contributors and agents to the source layout, key abstractions, and data flows in the {{project_name}} codebase. For governance philosophy see [CONSTITUTION.md](CONSTITUTION.md); for architectural contracts see [ARCHITECTURE.md](ARCHITECTURE.md); for coordination and Mission Stack rules see [PROTOCOL.md](PROTOCOL.md).
44

55
## Repository Layout
66

@@ -33,6 +33,7 @@ Trace a representative operation from entry point to completion.
3333
- Where does user input enter the system?
3434
- What validation or enforcement happens before execution?
3535
- How are results persisted and presented back?
36+
- Where do external or Mission Stack requests get normalized before local board mutations?
3637

3738
## Configuration
3839

templates/project/GEMINI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Before doing work, read:
1010
2. `INSTRUCTIONS.md`
1111
3. `POLICY.md`
1212
4. `ARCHITECTURE.md`
13+
5. `PROTOCOL.md`
1314

1415
Those files are the repo-wide operating contract. This file should stay thin and only capture Gemini-specific harness notes.
1516

templates/project/INSTRUCTIONS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Procedural instructions for humans and agents working with {{project_name}} thro
66

77
This file is downstream from Keel and should keep the engine's turn-loop discipline recognizable while describing how {{project_name}} actually operates.
88

9+
Mission Stack coordination is part of the formal downstream protocol surface. Hydrate `PROTOCOL.md` instead of inventing ad hoc cross-repo rules in chat or commit lore.
10+
911
When syncing from a newer Keel version, preserve the `PROJECT-SPECIFIC` block instead of re-authoring the local operating surface from scratch.
1012

1113
## The Turn Loop
@@ -46,6 +48,7 @@ Focus on **technical discovery and fog reduction**.
4648
- Add the exact build, test, runtime, or preview commands this repo expects.
4749
- Add any mandatory local wrappers such as `just check`, `pnpm test`, `cargo test`, or deploy smoke tests.
4850
- Add role-specific expectations if the repo uses designer, marketer, legal, or executive lanes in practice.
51+
- If this repo participates in Mission Stacks, point to the branch, checkpoint, handoff, and managed-worktree rules in `PROTOCOL.md`.
4952
<!-- END PROJECT-SPECIFIC -->
5053

5154
## Hydration Checklist
@@ -61,5 +64,6 @@ Before relying on this file as a real operating contract, fill in:
6164

6265
- Use the CLI as the canonical lifecycle surface.
6366
- Prefer board-backed proof over memory or chat summaries.
67+
- Treat Mission Stack coordination as a formal protocol. Another repo must not mutate this repo's `{{board_dir}}/` state directly.
6468
- Keep downstream wrappers truthful about the real repo commands.
6569
- Update this file when the repo workflow changes materially.

templates/project/POLICY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This document is downstream from Keel and should describe the operational invari
99
- The board lives in `{{board_dir}}/`.
1010
- The canonical tactical rhythm is the Turn Loop exposed by `keel turn`.
1111
- Board mutations, proof, and lifecycle closure happen through the CLI, not manual file edits.
12+
- Cross-repo coordination, including Mission Stacks, follows `PROTOCOL.md`; no peer repo or reactor may mutate this repo's `{{board_dir}}/` state directly.
1213

1314
## The Core Objective: Zero Drift
1415

@@ -34,6 +35,7 @@ Hydrate the rules that should always be true in this repository.
3435
- What must pass before a change can land?
3536
- What kinds of changes require explicit human review?
3637
- What evidence is required for code, product, UX, legal, or operational claims?
38+
- Which Mission Stack or external-ingress rules are binding for cross-repo work in this repository?
3739

3840
## Safety Rails
3941

templates/project/PROTOCOL.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# {{project_name}} Protocol
2+
3+
This document is downstream from Keel and should describe the protocol surfaces that external systems, peer reactors, and operators rely on when coordinating work with {{project_name}}.
4+
5+
## Downstream Contract
6+
7+
Use this file for stable coordination rules and data contracts, not for local implementation details.
8+
9+
Mission Stack coordination is part of the formal protocol surface. It should be documented here as an explicit contract rather than left as chat lore or repo-local habit.
10+
11+
## Protocol Scope
12+
13+
Hydrate the protocol surfaces that matter in this repository:
14+
15+
- ingress requests from humans, agents, or upstream systems
16+
- repo-to-repo handoff receipts
17+
- lifecycle acknowledgments and checkpoint signals
18+
- file, API, webhook, or queue payloads that other systems consume
19+
20+
## Mission Stack Coordination
21+
22+
Mission Stacks are a formal Keel protocol for cross-repo execution.
23+
24+
- Each participating repository remains authoritative for its own `{{board_dir}}/` state.
25+
- Cross-repo work should flow through explicit stack negotiation and handoff rather than direct mutation of another repo's planning artifacts.
26+
- Stack-linked work should use `stack/<id>` as the coordination branch unless this repo intentionally documents a narrower rule here.
27+
- Foreign execution in another member repo should happen through a managed worktree rather than that repo's primary checkout.
28+
- Hydrate any repo-specific checkpoint, receipt, approval, or cleanup expectations here.
29+
30+
## External Ingress
31+
32+
Describe how outside work enters {{project_name}}:
33+
34+
- accepted request shapes
35+
- validation and acknowledgment
36+
- how requests materialize into local mission lineage
37+
- rejection or retry behavior
38+
39+
## Data Contracts
40+
41+
Document stable contracts that other systems rely on:
42+
43+
- input shapes
44+
- output shapes
45+
- receipt or acknowledgment fields
46+
- versioning or migration expectations
47+
48+
## Local Exceptions
49+
50+
If {{project_name}} intentionally narrows or extends Keel's default protocol rules, document those deviations explicitly here.

0 commit comments

Comments
 (0)