@rashidee/co2 1.2.5
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/dist/index.js +25449 -0
- package/drizzle/0000_remarkable_charles_xavier.sql +210 -0
- package/drizzle/0001_wise_wolf_cub.sql +13 -0
- package/drizzle/0002_secret_spyke.sql +16 -0
- package/drizzle/0003_workspace_config_singleton.sql +16 -0
- package/drizzle/0004_terminal_claim_v120.sql +11 -0
- package/drizzle/0005_brainstorm_v124.sql +10 -0
- package/drizzle/0006_project_v140.sql +6 -0
- package/drizzle/0007_prd_wizard_v124.sql +14 -0
- package/drizzle/0008_workflow_artifact_v126.sql +24 -0
- package/drizzle/0009_project_import_v150.sql +7 -0
- package/drizzle/0010_quality_v151.sql +3 -0
- package/drizzle/meta/0000_snapshot.json +1335 -0
- package/drizzle/meta/0001_snapshot.json +1416 -0
- package/drizzle/meta/0002_snapshot.json +1510 -0
- package/drizzle/meta/_journal.json +83 -0
- package/package.json +41 -0
- package/plugin/.claude-plugin/marketplace.json +36 -0
- package/plugin/.claude-plugin/plugin.json +22 -0
- package/plugin/README.md +625 -0
- package/plugin/SKILLS.md +350 -0
- package/plugin/co2.svg +5 -0
- package/plugin/commands/brainstorm-loop.md +129 -0
- package/plugin/skills/conductor-defect/SKILL.md +898 -0
- package/plugin/skills/conductor-feature-develop/SKILL.md +1383 -0
- package/plugin/skills/conductor-feature-develop/references/implementation-domain-template.md +131 -0
- package/plugin/skills/conductor-feature-develop/references/implementation-master-template.md +89 -0
- package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +224 -0
- package/plugin/skills/conductor-feature-prepare/SKILL.md +604 -0
- package/plugin/skills/depgen-k8s/SKILL.md +468 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-laravel.md +197 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-nodejs.md +163 -0
- package/plugin/skills/depgen-k8s/references/dockerfile-spring-boot.md +174 -0
- package/plugin/skills/depgen-k8s/references/k8s-patterns.md +869 -0
- package/plugin/skills/mockgen-shadcn/SKILL.md +1067 -0
- package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +1467 -0
- package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +498 -0
- package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +216 -0
- package/plugin/skills/mockgen-tailwind/SKILL.md +904 -0
- package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +720 -0
- package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +498 -0
- package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -0
- package/plugin/skills/modelgen-nosql/SKILL.md +617 -0
- package/plugin/skills/modelgen-nosql/references/model-extraction-methodology.md +497 -0
- package/plugin/skills/modelgen-nosql/references/nosql-design-guide.md +258 -0
- package/plugin/skills/modelgen-relational/SKILL.md +707 -0
- package/plugin/skills/modelgen-relational/references/model-extraction-methodology.md +499 -0
- package/plugin/skills/specgen-flutter-riverpod/SKILL.md +898 -0
- package/plugin/skills/specgen-flutter-riverpod/references/component-patterns.md +971 -0
- package/plugin/skills/specgen-flutter-riverpod/references/notification-patterns.md +457 -0
- package/plugin/skills/specgen-flutter-riverpod/references/routing-patterns.md +362 -0
- package/plugin/skills/specgen-flutter-riverpod/references/security-patterns.md +709 -0
- package/plugin/skills/specgen-flutter-riverpod/references/spec-template.md +1566 -0
- package/plugin/skills/specgen-flutter-riverpod/references/state-patterns.md +518 -0
- package/plugin/skills/specgen-flutter-riverpod/references/storage-patterns.md +370 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/SKILL.md +984 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/batch-patterns.md +359 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/messaging-patterns.md +468 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/modulith-patterns.md +461 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/reporting-patterns.md +803 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/security-patterns.md +501 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/spec-template.md +1268 -0
- package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/web-patterns.md +301 -0
- package/plugin/skills/specgen-node-cli-web/SKILL.md +561 -0
- package/plugin/skills/specgen-node-cli-web/references/auth-patterns.md +293 -0
- package/plugin/skills/specgen-node-cli-web/references/cli-packaging-patterns.md +250 -0
- package/plugin/skills/specgen-node-cli-web/references/server-patterns.md +247 -0
- package/plugin/skills/specgen-node-cli-web/references/spec-template.md +401 -0
- package/plugin/skills/specgen-node-cli-web/references/testing-patterns.md +174 -0
- package/plugin/skills/specgen-react-mui/SKILL.md +789 -0
- package/plugin/skills/specgen-react-mui/references/component-patterns.md +1077 -0
- package/plugin/skills/specgen-react-mui/references/reporting-patterns.md +1998 -0
- package/plugin/skills/specgen-react-mui/references/routing-patterns.md +461 -0
- package/plugin/skills/specgen-react-mui/references/security-patterns.md +599 -0
- package/plugin/skills/specgen-react-mui/references/spec-template.md +1030 -0
- package/plugin/skills/specgen-react-mui/references/state-patterns.md +327 -0
- package/plugin/skills/specgen-react-tailwind/SKILL.md +859 -0
- package/plugin/skills/specgen-react-tailwind/references/component-patterns.md +1212 -0
- package/plugin/skills/specgen-react-tailwind/references/reporting-patterns.md +1529 -0
- package/plugin/skills/specgen-react-tailwind/references/routing-patterns.md +669 -0
- package/plugin/skills/specgen-react-tailwind/references/security-patterns.md +656 -0
- package/plugin/skills/specgen-react-tailwind/references/spec-template.md +1237 -0
- package/plugin/skills/specgen-react-tailwind/references/state-patterns.md +327 -0
- package/plugin/skills/specgen-sdk-java/SKILL.md +933 -0
- package/plugin/skills/specgen-sdk-java/references/api-extraction-patterns.md +247 -0
- package/plugin/skills/specgen-sdk-java/references/http-client-patterns.md +495 -0
- package/plugin/skills/specgen-sdk-java/references/packaging-patterns.md +366 -0
- package/plugin/skills/specgen-sdk-java/references/spec-template.md +956 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/SKILL.md +1284 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/batch-patterns.md +1224 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/jasper-patterns.md +1638 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/messaging-patterns.md +512 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/modulith-patterns.md +354 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/security-patterns.md +551 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/spec-template.md +2502 -0
- package/plugin/skills/specgen-spring-jpa-jtehtmx/references/web-patterns.md +503 -0
- package/plugin/skills/specgen-spring-jpa-restapi/SKILL.md +990 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/batch-patterns.md +1224 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/messaging-patterns.md +512 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/modulith-patterns.md +279 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/reporting-patterns.md +1536 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/restapi-patterns.md +722 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/security-patterns.md +351 -0
- package/plugin/skills/specgen-spring-jpa-restapi/references/spec-template.md +553 -0
- package/plugin/skills/specgen-ts-cli/SKILL.md +861 -0
- package/plugin/skills/specgen-ts-cli/references/async-patterns.md +1101 -0
- package/plugin/skills/specgen-ts-cli/references/command-patterns.md +383 -0
- package/plugin/skills/specgen-ts-cli/references/config-patterns.md +430 -0
- package/plugin/skills/specgen-ts-cli/references/database-patterns.md +750 -0
- package/plugin/skills/specgen-ts-cli/references/packaging-patterns.md +426 -0
- package/plugin/skills/specgen-ts-cli/references/spec-template.md +1391 -0
- package/plugin/skills/specgen-ts-cli/references/testing-patterns.md +909 -0
- package/plugin/skills/testgen-functional/SKILL.md +1381 -0
- package/plugin/skills/tracegen-matrix/SKILL.md +243 -0
- package/plugin/skills/util-preparek8senv/SKILL.md +422 -0
- package/plugin/skills/util-projectinit/SKILL.md +307 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-loop.md +129 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-protocol.md +144 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-setup-guide.md +153 -0
- package/plugin/skills/util-projectinit/reference/brainstorm-template-appdev.md +87 -0
- package/plugin/skills/util-projectinit/reference/co2-context-generation-guide.md +761 -0
- package/plugin/skills/util-projectsync/SKILL.md +501 -0
- package/plugin/skills/util-updprd/SKILL.md +324 -0
- package/plugin/skills/util-usanalyzer/SKILL.md +307 -0
- package/plugin/skills/util-ustagger/SKILL.md +154 -0
- package/static/assets/abnfDiagram-VRR7QNED-DvPuwyCV.js +1 -0
- package/static/assets/arc-DRKw7sjs.js +1 -0
- package/static/assets/architectureDiagram-ZJ3FMSHR-CaNcxUbC.js +36 -0
- package/static/assets/blockDiagram-677ZJIJ3-Demd4AOK.js +132 -0
- package/static/assets/c4Diagram-LMCZKHZV-PVKUfc2x.js +10 -0
- package/static/assets/channel-C2nVbuwv.js +1 -0
- package/static/assets/chunk-2Q5K7J3B-CExf8ww_.js +1 -0
- package/static/assets/chunk-32BRIVSS-CFPaoONF.js +1 -0
- package/static/assets/chunk-5VM5RSS4-DE2esM67.js +15 -0
- package/static/assets/chunk-EX3LRPZG-SON_YdDG.js +231 -0
- package/static/assets/chunk-JWPE2WC7-Qxah8LNr.js +1 -0
- package/static/assets/chunk-MOJQB5TN-BcWGQV3j.js +88 -0
- package/static/assets/chunk-RYQCIY6F-DkDj-OR5.js +1 -0
- package/static/assets/chunk-V7JOEXUC-BlI1Mrah.js +206 -0
- package/static/assets/chunk-VR4S4FIN-Agf__duj.js +1 -0
- package/static/assets/chunk-XXDRQBXY-B5CfAh85.js +1 -0
- package/static/assets/classDiagram-OUVF2IWQ-DXJIljsR.js +1 -0
- package/static/assets/classDiagram-v2-EOCWNBFH-DXJIljsR.js +1 -0
- package/static/assets/cose-bilkent-JH36ORCC-DO0cQkcy.js +1 -0
- package/static/assets/cynefin-VYW2F7L2-CfOnsnXc.js +178 -0
- package/static/assets/cynefinDiagram-TSTJHNR4-BJ8tULAv.js +62 -0
- package/static/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
- package/static/assets/dagre-VKFMJZFB-DfjwzHqP.js +4 -0
- package/static/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/static/assets/diagram-FQU43EPY-CndSOIIM.js +3 -0
- package/static/assets/diagram-G47NLZAW-Czf5hN0Z.js +24 -0
- package/static/assets/diagram-NH7WQ7WH-COAyojGh.js +24 -0
- package/static/assets/diagram-OA4YK3LP-H8PoiN2m.js +30 -0
- package/static/assets/diagram-WEI45ONY-DzcaVzjp.js +41 -0
- package/static/assets/ebnfDiagram-CCIWWBDH-DPazGYLJ.js +1 -0
- package/static/assets/erDiagram-Q63AITRT-Bo-fubgF.js +85 -0
- package/static/assets/flowDiagram-23GEKE2U-CSvxUDwh.js +156 -0
- package/static/assets/ganttDiagram-NO4QXBWP-DnBveWX6.js +292 -0
- package/static/assets/gitGraphDiagram-IHSO6WYX-B3rVL8c-.js +106 -0
- package/static/assets/graph-C9eacEi8.js +1 -0
- package/static/assets/index-LZSQkLE2.css +41 -0
- package/static/assets/index-y7XDSgMG.js +495 -0
- package/static/assets/infoDiagram-FWYZ7A6U-CvWV9yy2.js +2 -0
- package/static/assets/init-Gi6I4Gst.js +1 -0
- package/static/assets/ishikawaDiagram-FXEZZL3T-DF28a1N6.js +70 -0
- package/static/assets/journeyDiagram-5HDEW3XC-CB6CugYk.js +139 -0
- package/static/assets/kanban-definition-HUTT4EX6-ResSLF6d.js +89 -0
- package/static/assets/katex-C5jXJg4s.js +257 -0
- package/static/assets/layout-DEXfKzaS.js +1 -0
- package/static/assets/linear-CLO--ryk.js +1 -0
- package/static/assets/map-Czzmt4hB.js +1 -0
- package/static/assets/mindmap-definition-LN4V7U3C-BvW3EbxX.js +96 -0
- package/static/assets/ordinal-Cboi1Yqb.js +1 -0
- package/static/assets/pegDiagram-2B236MQR-BHCgqrrM.js +1 -0
- package/static/assets/pieDiagram-ENE6RG2P-DVmCQ5FA.js +39 -0
- package/static/assets/quadrantDiagram-ABIIQ3AL-B3e5KR52.js +7 -0
- package/static/assets/railroadDiagram-RFXS5EU6-Csv5ysLc.js +1 -0
- package/static/assets/requirementDiagram-TGXJPOKE-DOMVzvnB.js +84 -0
- package/static/assets/sankeyDiagram-HTMAVEWB-B1dcTOvy.js +40 -0
- package/static/assets/sequenceDiagram-DBY2YBRQ-BY414yeO.js +162 -0
- package/static/assets/sizeCapture-X5ZJPWSS-CuJfrfBN.js +1 -0
- package/static/assets/stateDiagram-2N3HPSRC-FX4rJkzV.js +1 -0
- package/static/assets/stateDiagram-v2-6OUMAXLB-BVufbO_H.js +1 -0
- package/static/assets/swimlanes-5IMT3BWC-Sfy58mmv.js +2 -0
- package/static/assets/swimlanesDiagram-G3AALYLV-wDCDw08H.js +8 -0
- package/static/assets/timeline-definition-FHXFAJF6-CmV7by8p.js +120 -0
- package/static/assets/vennDiagram-L72KCM5P-FqIyFZFt.js +34 -0
- package/static/assets/wardleyDiagram-EHGQE667-BZ06O45i.js +78 -0
- package/static/assets/xychartDiagram-FW5EYKEG-BOkffR06.js +7 -0
- package/static/index.html +24 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: util-projectinit
|
|
3
|
+
model: claude-sonnet-4-6
|
|
4
|
+
effort: medium
|
|
5
|
+
description: >
|
|
6
|
+
Initialize a new CO2 project by validating a hand-authored brainstorm session document and
|
|
7
|
+
setting up the file-based, turn-based BRAINSTORMING session kit around it. The ONLY valid
|
|
8
|
+
input is the path to an EXISTING `<topic>.brainstorm.md` file the user authored from the CO2
|
|
9
|
+
application-development template (`brainstorm-template-appdev.md`) — free-form prompts, idea
|
|
10
|
+
text or topic slugs are NOT accepted. The skill strictly validates the session document
|
|
11
|
+
against the template, rejecting with a report on any deviation — it never creates or edits
|
|
12
|
+
the session document. On a clean pass it scaffolds the rest of the brainstorm kit in the
|
|
13
|
+
project folder: the shared `brainstorm-protocol.md`, the `co2-context-generation-guide.md`
|
|
14
|
+
artifact rules, and the `/brainstorm-loop` slash command. The user then manually runs
|
|
15
|
+
`/brainstorm-loop` — an iterative, token-efficient loop that converges the root `CLAUDE.md`
|
|
16
|
+
(Phase A) and every application's `PRD.md` (Phase B) round by round. This skill seeds the
|
|
17
|
+
project — it is the first skill to run before any `modelgen-*`, `mockgen-*`, `specgen-*`,
|
|
18
|
+
`testgen-*`, `util-projectsync` or `util-preparek8senv` invocation.
|
|
19
|
+
Trigger on keywords: "init project", "initialize project", "start project", "bootstrap project",
|
|
20
|
+
"scaffold project", "new project", "project init", "brainstorm project", "brainstorm app idea",
|
|
21
|
+
"setup brainstorm", "start brainstorming", "brainstorm session", "generate CLAUDE.md".
|
|
22
|
+
Accepts one MANDATORY argument: the path to an existing `<topic>.brainstorm.md` session
|
|
23
|
+
document based on the CO2 template. If the argument is missing, is not a `.brainstorm.md`
|
|
24
|
+
path, or the file does not exist, the skill stops and instructs the user to copy the
|
|
25
|
+
template manually.
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Util Project Init — CO2 Brainstorm Session Setup
|
|
29
|
+
|
|
30
|
+
Bootstrap a new CO2 project by validating a **user-authored brainstorming session document**
|
|
31
|
+
and setting up the brainstorm kit around it. A one-shot generation from a one-paragraph brief
|
|
32
|
+
produces shallow, guessed context; the brainstorm loop instead converges the context **round by
|
|
33
|
+
round** — the agent drafts, asks focused questions, the user answers in the document, and the
|
|
34
|
+
drafts improve until the user locks them.
|
|
35
|
+
|
|
36
|
+
The brainstorm produces the complete CO2 project context tree:
|
|
37
|
+
|
|
38
|
+
- **Phase A** — root `CLAUDE.md` (apps, modules, bounded contexts, App Codes, App × Module matrix)
|
|
39
|
+
- **Phase B** — one `PRD.md` per custom application (versioned User Stories / NFRs / Constraints /
|
|
40
|
+
References / Tests)
|
|
41
|
+
|
|
42
|
+
`DEVTOOL.md` and `ENVIRONMENT.md` are NOT produced by the brainstorm — they come later
|
|
43
|
+
(`util-preparek8senv` and per-developer setup). Once the brainstorm session is CLOSED, downstream
|
|
44
|
+
skills (`util-projectsync`, `modelgen-*`, `mockgen-*`, `specgen-*`, `testgen-*`, `conductor-*`)
|
|
45
|
+
take over.
|
|
46
|
+
|
|
47
|
+
**This skill validates and sets up the kit only. It never creates or edits the session
|
|
48
|
+
document, and it never runs the brainstorm loop itself** — the user authors the session
|
|
49
|
+
document from the template beforehand and manually runs `/brainstorm-loop` when ready.
|
|
50
|
+
|
|
51
|
+
## The Kit
|
|
52
|
+
|
|
53
|
+
The session document is the **input** — hand-authored by the user from
|
|
54
|
+
`reference/brainstorm-template-appdev.md`. Three supporting files are copied from this skill's
|
|
55
|
+
`reference/` folder:
|
|
56
|
+
|
|
57
|
+
| File | Copied to | Role |
|
|
58
|
+
|------|-----------|------|
|
|
59
|
+
| `<topic>.brainstorm.md` | — (input — hand-authored by the user from `brainstorm-template-appdev.md`) | The session document the user fills in and the loop iterates on — validated by this skill, never created or edited by it |
|
|
60
|
+
| `brainstorm-protocol.md` | `<project-root>/brainstorm-protocol.md` | Shared static protocol (state machine, turn rules) — never edited during sessions |
|
|
61
|
+
| `co2-context-generation-guide.md` | `<project-root>/co2-context-generation-guide.md` | Artifact rules the agent follows when drafting CLAUDE.md and PRD.md — referenced from the session document |
|
|
62
|
+
| `brainstorm-loop.md` | `<project-root>/.claude/commands/brainstorm-loop.md` (only if the command is not already available) | The `/brainstorm-loop` slash command — the polling watch loop |
|
|
63
|
+
|
|
64
|
+
> **Plugin note:** when this skill is installed as part of the `co2-skills` plugin, the
|
|
65
|
+
> `/brainstorm-loop` command ships with the plugin (`commands/brainstorm-loop.md`) and is already
|
|
66
|
+
> available — the project-local copy is a fallback for setups where the skill files were copied
|
|
67
|
+
> manually into `.claude/skills/`.
|
|
68
|
+
|
|
69
|
+
Generated at runtime by the loop (never created by this skill):
|
|
70
|
+
`<project-root>/.brainstorm-loop-status.md` — the live dashboard + compaction advisory.
|
|
71
|
+
|
|
72
|
+
## Input Resolution
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
/util-projectinit <path-to-topic.brainstorm.md>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Argument | Required | Example | Description |
|
|
79
|
+
|----------|----------|---------|-------------|
|
|
80
|
+
| `<session-file>` | **Yes** | `recruitment-hub.brainstorm.md` | Path to an EXISTING session document authored by the user from `brainstorm-template-appdev.md`. Free-form idea text or topic slugs are NOT accepted. |
|
|
81
|
+
|
|
82
|
+
### Argument Rules
|
|
83
|
+
|
|
84
|
+
1. The argument is **mandatory**, must be a path whose filename ends in `.brainstorm.md`, and
|
|
85
|
+
must point to an existing file.
|
|
86
|
+
2. If the argument is omitted, is not a `.brainstorm.md` path, or the file does not exist →
|
|
87
|
+
**stop** and print the block below, substituting `<template-path>` with the resolved
|
|
88
|
+
absolute path of `reference/brainstorm-template-appdev.md` inside this skill's folder:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
## util-projectinit — session document required
|
|
92
|
+
|
|
93
|
+
This skill takes exactly one argument: the path to an existing
|
|
94
|
+
<topic>.brainstorm.md authored from the CO2 template. Free-form prompts
|
|
95
|
+
or idea text are not accepted.
|
|
96
|
+
|
|
97
|
+
To create one:
|
|
98
|
+
1. Copy the template
|
|
99
|
+
<template-path>
|
|
100
|
+
to your project root as <topic>.brainstorm.md
|
|
101
|
+
(topic = short kebab-case slug, e.g. recruitment-hub.brainstorm.md)
|
|
102
|
+
2. Fill in the human-owned parts:
|
|
103
|
+
- frontmatter: session_id (<topic>-co2-context), title, created (today, YYYY-MM-DD)
|
|
104
|
+
- # Context: describe your application idea
|
|
105
|
+
- ## References: optional style-reference files (relative paths; keep the `./co2-context-generation-guide.md` line)
|
|
106
|
+
- # Output Specification: confirm destination (default ./)
|
|
107
|
+
Leave untouched: state, current_round, protocol_version, # Objective,
|
|
108
|
+
# Status, # Question, # Output, # Feedback.
|
|
109
|
+
3. Re-run: /util-projectinit <topic>.brainstorm.md
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
3. **Never create the session document on the user's behalf** — not even a template copy.
|
|
113
|
+
|
|
114
|
+
## Validation
|
|
115
|
+
|
|
116
|
+
Read the session document and check it against `reference/brainstorm-template-appdev.md`.
|
|
117
|
+
Validation is **read-only and strict**: if ANY check fails, print the validation report
|
|
118
|
+
(format below) listing EVERY failed check with expected vs. found, and **stop** — do not set
|
|
119
|
+
up the kit. Never edit the session document; the user fixes it and re-runs.
|
|
120
|
+
|
|
121
|
+
| # | Check | Rule |
|
|
122
|
+
|---|-------|------|
|
|
123
|
+
| V1 | Frontmatter | YAML frontmatter present with `doc_type: ai-brainstorm-session` |
|
|
124
|
+
| V2 | `session_id` | Set, contains no `CHANGE-ME`, is kebab-case, ends with `-co2-context`, and its `<topic>` part matches the filename (`<topic>.brainstorm.md`) |
|
|
125
|
+
| V3 | `title` | Set, contains no `CHANGE ME` and no `<Project Name>` placeholder |
|
|
126
|
+
| V4 | `created` | A real `YYYY-MM-DD` date (not the `<YYYY-MM-DD>` placeholder) |
|
|
127
|
+
| V5 | `state` / `current_round` | Requires `state: NEW` and `current_round: 0`; if `state` instead holds a recognized in-progress/finished value (`AWAITING_HUMAN`, `AWAITING_AGENT`, `ERROR`, `CLOSED`), reject with *"this session is already in progress — resume it with `/brainstorm-loop` instead"*; if the fields are missing or hold an unrecognized value, report a plain expected-vs-found row instead |
|
|
128
|
+
| V6 | `protocol_version` | Exactly `"2.0"` |
|
|
129
|
+
| V7 | Sections | All template sections present: `# Objective`, `# Context` (with `## References`), `# Output Specification`, `# Status`, `# Question`, `# Output`, `# Feedback` |
|
|
130
|
+
| V8 | `# Context` filled | The `[DESCRIBE YOUR APPLICATION IDEA HERE]` placeholder is gone and the section contains non-empty prose |
|
|
131
|
+
| V9 | Guide reference | `## References` still lists `./co2-context-generation-guide.md` |
|
|
132
|
+
| V10 | Output Specification | `format` is `co2-tree` and `destination` is set |
|
|
133
|
+
| V11 | `# Status` table | Exactly the template's single row 0: `Session completion | Human | PENDING` |
|
|
134
|
+
| V12 | Agent-owned sections | `# Question`, `# Output` and `# Feedback` bodies are empty (HTML comments allowed) |
|
|
135
|
+
|
|
136
|
+
### Validation report format
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
## Session Document Validation FAILED — <file>
|
|
140
|
+
|
|
141
|
+
| # | Check | Expected | Found |
|
|
142
|
+
|---|-------|----------|-------|
|
|
143
|
+
| V4 | created date | real YYYY-MM-DD | <YYYY-MM-DD> (placeholder) |
|
|
144
|
+
| V8 | # Context filled | idea prose | [DESCRIBE YOUR APPLICATION IDEA HERE] |
|
|
145
|
+
|
|
146
|
+
Fix the items above in <file> and re-run:
|
|
147
|
+
/util-projectinit <file>
|
|
148
|
+
(This skill never edits your session document.)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Pre-Flight Checks
|
|
152
|
+
|
|
153
|
+
Inspect the project root (the folder where Claude Code was launched) before writing anything.
|
|
154
|
+
The skill is **non-destructive** — it never overwrites any existing file:
|
|
155
|
+
|
|
156
|
+
| Condition | Action |
|
|
157
|
+
|-----------|--------|
|
|
158
|
+
| Another `*.brainstorm.md` with `session_id: *-co2-context` exists (besides the input file) and is not `state: CLOSED` | Warn: a CO2 context session is already in progress; ask whether to set up this second session anyway or resume the existing one with `/brainstorm-loop`. |
|
|
159
|
+
| `CLAUDE.md` exists at the project root | Warn: the project looks already initialized. The brainstorm's destination will **overwrite CLAUDE.md draft-by-draft** once the loop runs. Since this skill never edits the session document, advise the user to change the session's `destination` to `./output/<project-code-lower>/` themselves and re-run if they want to keep the current CLAUDE.md untouched. Confirm before proceeding with `destination: ./`. |
|
|
160
|
+
| `brainstorm-protocol.md` / `co2-context-generation-guide.md` exist | Skip copying that file (log "already present"). |
|
|
161
|
+
| `.claude/commands/brainstorm-loop.md` exists | Skip the command copy. |
|
|
162
|
+
|
|
163
|
+
## Workflow
|
|
164
|
+
|
|
165
|
+
### 1. Validate the session document
|
|
166
|
+
|
|
167
|
+
Run the full V1–V12 validation above. On any failure: print the validation report and stop.
|
|
168
|
+
Only continue to the setup steps below on a clean pass.
|
|
169
|
+
|
|
170
|
+
### 2. Ensure the `/brainstorm-loop` command is available
|
|
171
|
+
|
|
172
|
+
1. If running as the `co2-skills` plugin, the command is already installed with the plugin —
|
|
173
|
+
nothing to do.
|
|
174
|
+
2. Otherwise (or when unsure), copy `reference/brainstorm-loop.md` from this skill's folder to
|
|
175
|
+
`<project-root>/.claude/commands/brainstorm-loop.md` (create the `.claude/commands/` folder if
|
|
176
|
+
needed). Do not modify the file content.
|
|
177
|
+
3. Remind the user in the final instructions: if `/brainstorm-loop` is not recognized, restart the
|
|
178
|
+
Claude Code session so newly added commands are picked up.
|
|
179
|
+
|
|
180
|
+
### 3. Copy the protocol and the generation guide to the project root
|
|
181
|
+
|
|
182
|
+
Copy verbatim from this skill's `reference/` folder:
|
|
183
|
+
|
|
184
|
+
- `brainstorm-protocol.md` → `<project-root>/brainstorm-protocol.md`
|
|
185
|
+
- `co2-context-generation-guide.md` → `<project-root>/co2-context-generation-guide.md`
|
|
186
|
+
|
|
187
|
+
Both must sit at the **scan root** (the project root): the loop reads the protocol from there,
|
|
188
|
+
and the session document references the guide as `./co2-context-generation-guide.md`.
|
|
189
|
+
|
|
190
|
+
### 4. Recommend permission pre-approval (Claude Code CLI)
|
|
191
|
+
|
|
192
|
+
The watch loop's blocking poll uses `find`, `sleep`, `md5sum` and `sort` via Bash. An unanswered
|
|
193
|
+
permission prompt **silently pauses the loop** while the user thinks it is watching. Tell the
|
|
194
|
+
user to either:
|
|
195
|
+
|
|
196
|
+
- choose **"Yes, and don't ask again"** on the first permission prompt after starting the loop, or
|
|
197
|
+
- pre-approve in `<project-root>/.claude/settings.json`:
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"permissions": {
|
|
202
|
+
"allow": [
|
|
203
|
+
"Bash(find:*)",
|
|
204
|
+
"Bash(sleep:*)",
|
|
205
|
+
"Bash(md5sum:*)",
|
|
206
|
+
"Bash(sort:*)"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
If the user asks the skill to do it, merge these entries into the existing
|
|
213
|
+
`.claude/settings.json` (or `.claude/settings.local.json` if the user prefers not to commit
|
|
214
|
+
them) without removing anything already there.
|
|
215
|
+
|
|
216
|
+
### 5. Print the instruction block
|
|
217
|
+
|
|
218
|
+
End with a single instruction block. This is the hand-off — the skill stops here and the user
|
|
219
|
+
drives the rest from the Claude Code CLI:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
## Brainstorm Session Ready
|
|
223
|
+
|
|
224
|
+
### Files set up
|
|
225
|
+
| File | Status |
|
|
226
|
+
|------|--------|
|
|
227
|
+
| <topic>.brainstorm.md | Validated — YOUR session document (V1–V12 passed) |
|
|
228
|
+
| brainstorm-protocol.md | Copied |
|
|
229
|
+
| co2-context-generation-guide.md | Copied |
|
|
230
|
+
| .claude/commands/brainstorm-loop.md | Copied | (or "Provided by co2-skills plugin")
|
|
231
|
+
|
|
232
|
+
### Next steps (manual)
|
|
233
|
+
|
|
234
|
+
1. VERIFY the session document <topic>.brainstorm.md one last time in your editor:
|
|
235
|
+
- `# Context` — your application idea is stated the way you want it; the
|
|
236
|
+
agent probes for the rest round by round.
|
|
237
|
+
- `## References` — style-reference files (an existing CLAUDE.md or PRD.md)
|
|
238
|
+
are listed as relative paths, if you want them used.
|
|
239
|
+
- `# Output Specification` — `destination` is where you want the context
|
|
240
|
+
tree drafted (default `./` = this project root).
|
|
241
|
+
- Do NOT touch `state`, `current_round`, `# Status`, `# Question`, `# Output`.
|
|
242
|
+
|
|
243
|
+
2. START the loop in this Claude Code session:
|
|
244
|
+
|
|
245
|
+
/brainstorm-loop
|
|
246
|
+
|
|
247
|
+
(add the folder as an argument if your session file lives elsewhere:
|
|
248
|
+
`/brainstorm-loop <scan-root>`). If the command is not recognized, restart
|
|
249
|
+
Claude Code and run it again.
|
|
250
|
+
|
|
251
|
+
3. ITERATE — each round:
|
|
252
|
+
- The agent drafts CLAUDE.md/PRD.md to the destination and appends numbered
|
|
253
|
+
questions under `# Question > ## Round N`.
|
|
254
|
+
- Answer under each `### Answer X` (unanswered = "agent's judgment"), save as
|
|
255
|
+
often as you like — saves alone never trigger the agent.
|
|
256
|
+
- COMMIT your turn by flipping exactly ONE row in the `# Status` table:
|
|
257
|
+
keep iterating → set `Round N answers and feedback` to COMPLETED
|
|
258
|
+
finish → set `Session completion` (row 0) to COMPLETED
|
|
259
|
+
- The agent wakes within ~60 s of the flip.
|
|
260
|
+
|
|
261
|
+
4. WATCH `.brainstorm-loop-status.md` (the live dashboard):
|
|
262
|
+
- `compact_advice: RECOMMENDED/REQUIRED` → at your next pause run /compact,
|
|
263
|
+
then /brainstorm-loop again. Nothing is lost — the documents are the database.
|
|
264
|
+
|
|
265
|
+
5. WHEN CLOSED — the CO2 context tree (CLAUDE.md + per-app PRD.md) is at the
|
|
266
|
+
destination. Continue the CO2 workflow:
|
|
267
|
+
- /util-projectsync → scaffold app folders, PRD.md/BUG.md reconciliation
|
|
268
|
+
- /conductor-feature-prepare → models, mockups, specifications, test specs
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Adapt the block to what actually happened (files skipped because they existed, plugin-provided
|
|
272
|
+
command).
|
|
273
|
+
|
|
274
|
+
## Important Rules
|
|
275
|
+
|
|
276
|
+
- **Validate-only for the session document.** Never create, copy, template-fill, or edit
|
|
277
|
+
`<topic>.brainstorm.md` — not to fix a placeholder, not to correct a date, not even when the
|
|
278
|
+
user asks during setup. On any validation failure, report and stop; the user edits the file.
|
|
279
|
+
- **Setup only — never run the loop.** Always end by instructing the user to run
|
|
280
|
+
`/brainstorm-loop` manually.
|
|
281
|
+
- **Non-destructive.** Never overwrite an existing `brainstorm-protocol.md`,
|
|
282
|
+
`co2-context-generation-guide.md`, or `.claude/commands/brainstorm-loop.md`. Skip and report.
|
|
283
|
+
- **Copy verbatim.** The protocol, guide, and command files are copied byte-for-byte from
|
|
284
|
+
`reference/` — never edited, summarized, or "improved" during setup.
|
|
285
|
+
- **One session document per topic.** Multiple independent sessions are allowed (the protocol
|
|
286
|
+
isolates them), but warn before setting up a second `*-co2-context` session for the same
|
|
287
|
+
project.
|
|
288
|
+
- **The session document is fully human-owned.** This skill reads it for validation and
|
|
289
|
+
nothing more. It never pre-answers questions, never adds rounds, never touches the Status
|
|
290
|
+
table.
|
|
291
|
+
- **Claude Code CLI is the interaction surface.** Instructions must be terminal-friendly: the
|
|
292
|
+
loop runs inside the live session (no headless `claude -p`), the user edits the session file in
|
|
293
|
+
a separate editor while the loop watches, and permission prompts appear in the terminal — an
|
|
294
|
+
unanswered one silently pauses the loop (hence the pre-approval step).
|
|
295
|
+
- **Do not create per-application folders, DEVTOOL.md, ENVIRONMENT.md, or K8s manifests.** The
|
|
296
|
+
brainstorm produces CLAUDE.md + PRD.md; folder scaffolding is `util-projectsync`'s job and
|
|
297
|
+
environment expansion is `util-preparek8senv`'s job.
|
|
298
|
+
|
|
299
|
+
## Reference Files
|
|
300
|
+
|
|
301
|
+
| File | Read when |
|
|
302
|
+
|------|-----------|
|
|
303
|
+
| `reference/brainstorm-setup-guide.md` | For the full end-to-end walkthrough (setup, iteration cycle, compaction, troubleshooting) — use it to answer any user question about how the loop works |
|
|
304
|
+
| `reference/brainstorm-protocol.md` | To answer questions about the state machine, turn rules, or error handling |
|
|
305
|
+
| `reference/brainstorm-template-appdev.md` | The template users copy manually to author their session document — also the validation baseline for V1–V12 |
|
|
306
|
+
| `reference/co2-context-generation-guide.md` | The artifact rules the loop's agent follows (Phase A/B, probing checklists, CLAUDE.md/PRD.md content rules) |
|
|
307
|
+
| `reference/brainstorm-loop.md` | The `/brainstorm-loop` command source |
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: In-session loop — watch a folder for AI brainstorm session documents and advance each per the shared protocol (60s polling, token-efficient)
|
|
3
|
+
argument-hint: [scan-root] [max-watch-rounds]
|
|
4
|
+
allowed-tools: Bash(find:*), Bash(sleep:*), Bash(md5sum:*), Bash(sort:*), Bash(bash:*), Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Brainstorm Session Loop (in-session, token-efficient)
|
|
8
|
+
|
|
9
|
+
You are the **AI Agent** actor defined in `brainstorm-protocol.md`. Read that file
|
|
10
|
+
from the scan root FIRST and follow it exactly. This command defines only the
|
|
11
|
+
polling mechanics; the protocol governs all document handling.
|
|
12
|
+
|
|
13
|
+
**Scan root**: `$1` (default: current working directory)
|
|
14
|
+
**Max watch rounds**: `$2` (default: 20 — each watch round blocks up to ~9 minutes,
|
|
15
|
+
so the default covers roughly a 3-hour working session)
|
|
16
|
+
|
|
17
|
+
## Core principle: pay tokens only for change
|
|
18
|
+
|
|
19
|
+
You have session memory — use it. Maintain an in-memory cache across cycles:
|
|
20
|
+
`{ file_path → (mtime, state, current_round, last_turn_decision) }`.
|
|
21
|
+
Never fully re-read a file whose mtime is unchanged since you last processed it.
|
|
22
|
+
|
|
23
|
+
## Phase 1 — Initial full scan (once, at invocation)
|
|
24
|
+
|
|
25
|
+
1. `find <scan-root> -name '*.brainstorm.md' -not -path '*/node_modules/*' -printf '%p %T@\n'`
|
|
26
|
+
2. For each file, read the frontmatter head; keep only `doc_type: ai-brainstorm-session`.
|
|
27
|
+
3. Build the cache. For every document where it is YOUR TURN per the Status table
|
|
28
|
+
(protocol §5.1 NEW / §5.3 continue / §5.4 finalize), act now — one document at a
|
|
29
|
+
time, sequentially, with strict session isolation (§6.7) and the pre-write
|
|
30
|
+
re-read rule (§6.8). Update the cache after each write.
|
|
31
|
+
4. Report one concise summary line.
|
|
32
|
+
|
|
33
|
+
## Phase 2 — Watch loop (repeat up to max-watch-rounds)
|
|
34
|
+
|
|
35
|
+
Run this single BLOCKING bash call (set the bash timeout to 600000 ms). It polls
|
|
36
|
+
internally every 60 s and returns early only when something changed — idle waiting
|
|
37
|
+
costs you zero tokens:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
ROOT="<scan-root>"
|
|
41
|
+
snap() { find "$ROOT" -name '*.brainstorm.md' -not -path '*/node_modules/*' -printf '%p %T@\n' | sort | md5sum; }
|
|
42
|
+
S0=$(snap)
|
|
43
|
+
for i in 1 2 3 4 5 6 7 8 9; do
|
|
44
|
+
sleep 60
|
|
45
|
+
S1=$(snap)
|
|
46
|
+
if [ "$S0" != "$S1" ]; then echo "CHANGED"; exit 0; fi
|
|
47
|
+
done
|
|
48
|
+
echo "UNCHANGED"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- On `UNCHANGED`: emit nothing except a minimal heartbeat (e.g. `…watching (round 4/20)`),
|
|
52
|
+
then start the next watch round. Do not re-read any files.
|
|
53
|
+
- On `CHANGED`: re-run the find/printf listing, diff mtimes against the cache, and
|
|
54
|
+
fully re-read ONLY the changed files (plus any brand-new files). For each changed
|
|
55
|
+
document, derive the turn from its Status table (authoritative over frontmatter)
|
|
56
|
+
and act per protocol §5.1 / §5.3 / §5.4 if it is your turn. A human save without a
|
|
57
|
+
status flip is not your turn — update the cached mtime and resume watching.
|
|
58
|
+
Update the runtime status file, then report one concise line, e.g.:
|
|
59
|
+
`advanced api-key-rotation (round 2 → 3); finalized cost-model (xlsx written); 1 still awaiting human`
|
|
60
|
+
|
|
61
|
+
## Runtime status file (compaction advisory)
|
|
62
|
+
|
|
63
|
+
Maintain a runtime dashboard at `<scan-root>/.brainstorm-loop-status.md`. This file
|
|
64
|
+
is intentionally OUTSIDE the `*.brainstorm.md` watch glob — the watcher must never
|
|
65
|
+
see it (writing to it must not trigger a wake). Update it only at moments you are
|
|
66
|
+
already awake: after the Phase 1 scan, after acting on any document, and at the end
|
|
67
|
+
of every watch round. Never wake solely to update it.
|
|
68
|
+
|
|
69
|
+
Format (override the whole file each update):
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
# Brainstorm Loop Status
|
|
73
|
+
- loop_started: <ISO timestamp>
|
|
74
|
+
- watch_round: 7 / 20
|
|
75
|
+
- agent_actions_this_conversation: 9
|
|
76
|
+
- compact_advice: OK <!-- OK | RECOMMENDED | REQUIRED -->
|
|
77
|
+
- advice_reason: —
|
|
78
|
+
|
|
79
|
+
## Sessions
|
|
80
|
+
| session_id | state | round | last activity |
|
|
81
|
+
| ---------------- | -------------- | ----- | -------------------- |
|
|
82
|
+
| api-key-rotation | AWAITING_HUMAN | 3 | agent asked round 3 |
|
|
83
|
+
| cost-model | CLOSED | 5 | xlsx finalized |
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Advisory heuristic (token count is not directly observable — use work proxies):
|
|
87
|
+
- `OK` — fewer than ~10 agent actions since the conversation started (or since the
|
|
88
|
+
user last compacted) and under 2/3 of max watch rounds.
|
|
89
|
+
- `RECOMMENDED` — ~10+ agent actions, or watch rounds past 2/3 of max, or any
|
|
90
|
+
single action involved reading large reference files. Set advice_reason
|
|
91
|
+
accordingly (e.g. "12 actions incl. 2 large reference reads").
|
|
92
|
+
- `REQUIRED` — max watch rounds reached; the loop is stopping. Reason:
|
|
93
|
+
"loop halted — run /compact then /brainstorm-loop to resume".
|
|
94
|
+
|
|
95
|
+
If the user tells you they have compacted (or you detect compaction per the
|
|
96
|
+
post-compaction rule), reset the action counter and advice to OK after the
|
|
97
|
+
Phase 1 rescan.
|
|
98
|
+
|
|
99
|
+
## Context hygiene
|
|
100
|
+
|
|
101
|
+
- Keep per-cycle output to 1–2 lines. Never echo document contents back into chat
|
|
102
|
+
unless the user asks.
|
|
103
|
+
- If ALL sessions reach `CLOSED`, say so and stop the loop early.
|
|
104
|
+
- On reaching max watch rounds with sessions still active, stop and tell the user:
|
|
105
|
+
run `/compact` if the session is long, then re-invoke `/brainstorm-loop` — the
|
|
106
|
+
first phase-1 scan will rebuild the cache from the files, so nothing is lost.
|
|
107
|
+
- All coordination state lives in the documents, never only in your memory: after
|
|
108
|
+
every action, frontmatter `state`/`current_round` must reflect reality, so a
|
|
109
|
+
compaction or restart is always safe.
|
|
110
|
+
|
|
111
|
+
## Post-compaction rule
|
|
112
|
+
|
|
113
|
+
If this conversation has been compacted (auto or manual) at any point since the
|
|
114
|
+
last Phase 1 scan, treat your in-memory cache and any remembered per-session
|
|
115
|
+
conclusions as INVALID. Immediately redo Phase 1 (full scan, rebuild cache,
|
|
116
|
+
re-derive every turn from the Status tables) before taking any action. Never act
|
|
117
|
+
on a summarized memory of a document's state — the files are the only truth.
|
|
118
|
+
|
|
119
|
+
## Hard boundaries
|
|
120
|
+
|
|
121
|
+
- Never set `Session completion` yourself.
|
|
122
|
+
- Never edit Human-owned content (answers, feedback, Objective, Context,
|
|
123
|
+
Output Specification).
|
|
124
|
+
- Never let one session's content influence another (protocol §6.7).
|
|
125
|
+
|
|
126
|
+
## Portability note
|
|
127
|
+
|
|
128
|
+
`find -printf` is GNU find (Linux / Git Bash / WSL). On macOS/BSD, substitute:
|
|
129
|
+
`find "$ROOT" -name '*.brainstorm.md' -exec stat -f '%N %m' {} \; | sort | md5sum`
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# AI Brainstorm Session Protocol (v2.0)
|
|
2
|
+
|
|
3
|
+
This document defines the shared protocol for all AI brainstorm session documents.
|
|
4
|
+
It is **static** — never edited during a session. All per-session state lives in the
|
|
5
|
+
session documents themselves.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Discovery
|
|
10
|
+
|
|
11
|
+
The AI Agent identifies session documents by scanning a root folder **recursively** using:
|
|
12
|
+
|
|
13
|
+
1. **Filename pre-filter**: glob pattern `**/*.brainstorm.md`
|
|
14
|
+
2. **Authoritative marker**: YAML frontmatter containing `doc_type: ai-brainstorm-session`
|
|
15
|
+
|
|
16
|
+
A file matching the glob but missing the frontmatter marker is **ignored** (not an error).
|
|
17
|
+
A file with the marker but a malformed structure is moved to `state: ERROR` (see §7).
|
|
18
|
+
|
|
19
|
+
## 2. Session Document Anatomy
|
|
20
|
+
|
|
21
|
+
Every session document contains, in order:
|
|
22
|
+
|
|
23
|
+
| Section | Owner | Purpose |
|
|
24
|
+
| ---------------------- | -------- | -------------------------------------------------------------- |
|
|
25
|
+
| YAML frontmatter | AI Agent | Machine-readable state for cheap scanning (human sets it once at creation) |
|
|
26
|
+
| `# Objective` | Human | What this session must produce |
|
|
27
|
+
| `# Context` | Human | Background the agent needs; may include `## References` to external files |
|
|
28
|
+
| `# Output Specification` | Human | Format, destination, and versioning of the final artifact |
|
|
29
|
+
| `# Status` | Both | The turn-based state table — the **single source of truth** |
|
|
30
|
+
| `# Question` | Both | Agent appends `## Round N` with questions; Human writes answers |
|
|
31
|
+
| `# Output` | AI Agent | The inline draft, overridden every round |
|
|
32
|
+
| `# Feedback` | Human | Optional per-round free-form feedback |
|
|
33
|
+
|
|
34
|
+
## 3. Frontmatter Schema
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
---
|
|
38
|
+
doc_type: ai-brainstorm-session # REQUIRED — discovery marker
|
|
39
|
+
session_id: <unique-slug> # REQUIRED — set by human at creation
|
|
40
|
+
title: <short human-readable name>
|
|
41
|
+
created: <YYYY-MM-DD>
|
|
42
|
+
state: NEW # NEW | AWAITING_HUMAN | AWAITING_AGENT | CLOSED | ERROR
|
|
43
|
+
current_round: 0 # maintained by AI Agent
|
|
44
|
+
protocol_version: "2.0"
|
|
45
|
+
---
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- `state` and `current_round` are **maintained by the AI Agent only**. The Human never edits them.
|
|
49
|
+
- The Human's sole write surfaces are: answers, feedback, and the `Status` table.
|
|
50
|
+
|
|
51
|
+
## 4. State Machine
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
agent writes Round 1 questions
|
|
55
|
+
NEW ──────────────────────────────────────► AWAITING_HUMAN
|
|
56
|
+
│
|
|
57
|
+
human flips "Round N answers and feedback" → COMPLETED
|
|
58
|
+
│
|
|
59
|
+
▼
|
|
60
|
+
agent updates draft + AWAITING_AGENT
|
|
61
|
+
writes Round N+1 questions │
|
|
62
|
+
AWAITING_HUMAN ◄─────────────────────────────────┘
|
|
63
|
+
│
|
|
64
|
+
│ human flips "Session completion" → COMPLETED
|
|
65
|
+
▼
|
|
66
|
+
agent renders final artifact per Output Specification
|
|
67
|
+
│
|
|
68
|
+
▼
|
|
69
|
+
CLOSED (ERROR is reachable from any state on malformed input)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The frontmatter `state` is a **cache** of the state derived from the Status table.
|
|
73
|
+
If they ever disagree, the **Status table wins** and the agent repairs the frontmatter.
|
|
74
|
+
|
|
75
|
+
## 5. Turn Protocol (Steps)
|
|
76
|
+
|
|
77
|
+
### 5.1 AI Agent turn — starting a session (`state: NEW`)
|
|
78
|
+
1. Read `Objective`, `Context` (fetch and read every file listed under `References`), and `Output Specification`.
|
|
79
|
+
2. Write an initial draft in the `Output` section (points form, concise).
|
|
80
|
+
3. Append `## Round 1` under `# Question` with numbered `### Question X` / `### Answer X` pairs.
|
|
81
|
+
4. Append `## Round 1` under `# Feedback` (empty, for the Human to fill).
|
|
82
|
+
5. Append **two** rows to the Status table:
|
|
83
|
+
- `Round 1 questions development` — Action By: AI Agent — `COMPLETED`
|
|
84
|
+
- `Round 1 answers and feedback` — Action By: Human — `PENDING`
|
|
85
|
+
6. Set frontmatter `state: AWAITING_HUMAN`, `current_round: 1`.
|
|
86
|
+
7. Write ordering rule: content sections first, Status table second, frontmatter state **last**
|
|
87
|
+
(the state flip is the agent's commit signal).
|
|
88
|
+
|
|
89
|
+
### 5.2 Human turn (`state: AWAITING_HUMAN`)
|
|
90
|
+
1. Write answers below each question in the current `Round N` section.
|
|
91
|
+
2. Optionally write feedback under `Feedback > Round N`.
|
|
92
|
+
3. Commit by flipping **exactly one** status:
|
|
93
|
+
- Continue iterating → set `Round N answers and feedback` to `COMPLETED`
|
|
94
|
+
- End the session → set `Session completion` (row 0) to `COMPLETED`
|
|
95
|
+
4. The Human may save the file any number of times before the flip; the agent
|
|
96
|
+
acts **only** on the status flip.
|
|
97
|
+
|
|
98
|
+
### 5.3 AI Agent turn — continuing (`Round N answers = COMPLETED`, session not complete)
|
|
99
|
+
1. Re-read the entire document (answers + feedback for round N).
|
|
100
|
+
2. **Override** (never append) the `Output` section with the improved draft.
|
|
101
|
+
3. Append `## Round N+1` questions and the matching empty `Feedback` round.
|
|
102
|
+
4. Append the two status rows for round N+1 (agent row `COMPLETED`, human row `PENDING`).
|
|
103
|
+
5. Update frontmatter `current_round`, keep `state: AWAITING_HUMAN`.
|
|
104
|
+
|
|
105
|
+
### 5.4 AI Agent turn — finalizing (`Session completion = COMPLETED`)
|
|
106
|
+
1. Incorporate any final answers/feedback into the draft.
|
|
107
|
+
2. Render the **final artifact** exactly as declared in `Output Specification`:
|
|
108
|
+
- `md-inline` → final content stays in the `Output` section
|
|
109
|
+
- `md-file` / `xlsx` / `docx` / `pptx` → generate the file at `destination`,
|
|
110
|
+
honoring the `versioning` policy (`overwrite` or `timestamped` suffix `-YYYYMMDD-HHmmss`)
|
|
111
|
+
3. Record the artifact location in the `Output` section under `## Final Artifact`.
|
|
112
|
+
4. Set frontmatter `state: CLOSED`.
|
|
113
|
+
|
|
114
|
+
## 6. Rules
|
|
115
|
+
|
|
116
|
+
1. The Status table is the single source of truth for turn-taking; frontmatter is a scan cache.
|
|
117
|
+
2. The AI Agent must wait for the relevant Human status to be `COMPLETED` before acting.
|
|
118
|
+
3. Drafts in `Output` are in points form, concise, and **overridden** every round.
|
|
119
|
+
4. There is no maximum number of rounds.
|
|
120
|
+
5. The AI Agent never sets `Session completion` — only the Human ends a session.
|
|
121
|
+
6. Round sections are appended dynamically — never pre-create empty rounds.
|
|
122
|
+
7. **Session isolation**: each document is an independent session. The agent must not
|
|
123
|
+
carry objectives, assumptions, or conclusions from one session into another, even
|
|
124
|
+
within a single loop run. Re-derive all context from the document (and its
|
|
125
|
+
References) on every turn.
|
|
126
|
+
8. **Write safety**: before writing to a document, the agent re-reads it (or re-checks
|
|
127
|
+
its mtime against the value captured at scan time). If it changed since the scan,
|
|
128
|
+
restart processing of that document from a fresh read.
|
|
129
|
+
9. Unanswered questions in a completed round are treated as "Human defers to the
|
|
130
|
+
agent's judgment" — the agent proceeds and notes the assumption in the draft.
|
|
131
|
+
10. The agent processes documents one at a time, fully completing its turn on one
|
|
132
|
+
session before touching the next.
|
|
133
|
+
|
|
134
|
+
## 7. Error Handling
|
|
135
|
+
|
|
136
|
+
If a document carries the discovery marker but is structurally unusable (missing
|
|
137
|
+
Status table, missing Objective, unreadable Reference file, contradictory statuses):
|
|
138
|
+
|
|
139
|
+
1. The agent appends a `# Agent Notice` section at the end of the document describing
|
|
140
|
+
exactly what is wrong and what the Human must fix.
|
|
141
|
+
2. The agent sets frontmatter `state: ERROR`.
|
|
142
|
+
3. On subsequent cycles the agent re-checks `ERROR` documents **only** if their mtime
|
|
143
|
+
is newer than the notice (i.e., the Human has edited since). If the problem is
|
|
144
|
+
fixed, the agent removes the notice and resumes from the derived state.
|