@firatcand/roster 0.1.0 → 1.0.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/README.md +77 -215
- package/agents/lesson-drafter.md +3 -8
- package/agents/pattern-detector.md +0 -1
- package/bin/roster.js +7233 -1197
- package/data/plan-ceilings.yaml +57 -0
- package/package.json +8 -3
- package/skills/chief-of-staff/SKILL.md +199 -59
- package/skills/dreamer/SKILL.md +8 -7
- package/skills/roster-orchestrator/SKILL.md +53 -25
- package/templates/CLAUDE.project.template.md +1 -1
- package/templates/CONTEXT.template.md +2 -2
- package/templates/gitignore-defaults.txt +2 -0
- package/templates/hooks/banner.sh +47 -0
- package/templates/scaffold/chief-of-staff/README.md +16 -24
- package/templates/scaffold/chief-of-staff/agent.md +22 -32
- package/templates/scaffold/chief-of-staff/plans/audit-agent.yaml +4 -4
- package/templates/scaffold/chief-of-staff/plans/audit-repo.yaml +5 -4
- package/templates/scaffold/chief-of-staff/plans/create-agent.yaml +5 -34
- package/templates/scaffold/config/project.yaml.template +10 -0
- package/templates/scaffold/conventions.md +188 -173
- package/templates/scaffold/dreamer/README.md +2 -2
- package/templates/scaffold/dreamer/agent.md +0 -1
- package/templates/scaffold/dreamer/plans/nightly-reflection.yaml +23 -37
- package/templates/scaffold/dreamer/subagents/lesson-drafter.md +2 -7
- package/templates/scaffold/{projects/_demo/guidelines → guidelines}/asset-links.md +4 -0
- package/templates/scaffold/{projects/_demo/guidelines → guidelines}/brand-book.md +4 -0
- package/templates/scaffold/{projects/_demo/guidelines → guidelines}/messaging.md +4 -0
- package/templates/scaffold/{projects/_demo/guidelines → guidelines}/voice.md +4 -0
- package/templates/scaffold/logs/cron/.gitkeep +1 -0
- package/templates/scaffold/ops/EXPERT.md +5 -5
- package/templates/scaffold/scripts/audit-agent.sh +326 -0
- package/templates/scaffold/scripts/audit-repo.sh +218 -0
- package/templates/scaffold/scripts/create-function.sh +267 -0
- package/templates/scaffold/scripts/lib/README.md +6 -1
- package/templates/scaffold/scripts/lib/bindings-prompt.sh +53 -0
- package/templates/scaffold/scripts/lib/functions.sh +17 -5
- package/templates/scaffold/scripts/new-agent.sh +416 -0
- package/templates/scaffold/scripts/rename-agent.sh +91 -0
- package/templates/scaffold/scripts/save-state.sh +32 -0
- package/agents/critic.md +0 -74
- package/agents/enricher.md +0 -56
- package/agents/promotion-arbiter.md +0 -71
- package/agents/prospector.md +0 -51
- package/agents/writer.md +0 -58
- package/skills/sdr/SKILL.md +0 -147
- package/templates/scaffold/chief-of-staff/plans/add-agent-to-project.yaml +0 -45
- package/templates/scaffold/chief-of-staff/plans/archive-project.yaml +0 -51
- package/templates/scaffold/chief-of-staff/plans/audit-project.yaml +0 -34
- package/templates/scaffold/chief-of-staff/plans/create-project.yaml +0 -65
- package/templates/scaffold/chief-of-staff/plans/remove-agent-from-project.yaml +0 -50
- package/templates/scaffold/chief-of-staff/plans/rename-project.yaml +0 -62
- package/templates/scaffold/chief-of-staff/plans/unarchive-project.yaml +0 -41
- package/templates/scaffold/dreamer/subagents/promotion-arbiter.md +0 -64
- package/templates/scaffold/gtm/sdr/.claude/settings.json +0 -3
- package/templates/scaffold/gtm/sdr/.mcp.json +0 -21
- package/templates/scaffold/gtm/sdr/README.md +0 -46
- package/templates/scaffold/gtm/sdr/agent.md +0 -136
- package/templates/scaffold/gtm/sdr/plans/cold-outreach.yaml +0 -92
- package/templates/scaffold/gtm/sdr/projects/_demo/asset-references.md +0 -7
- package/templates/scaffold/gtm/sdr/projects/_demo/config/default.yaml +0 -69
- package/templates/scaffold/gtm/sdr/projects/_demo/log/feedback/.gitkeep +0 -0
- package/templates/scaffold/gtm/sdr/projects/_demo/log/runs/.gitkeep +0 -0
- package/templates/scaffold/gtm/sdr/projects/_demo/playbook/.gitkeep +0 -0
- package/templates/scaffold/gtm/sdr/subagents/critic.md +0 -67
- package/templates/scaffold/gtm/sdr/subagents/enricher.md +0 -49
- package/templates/scaffold/gtm/sdr/subagents/prospector.md +0 -44
- package/templates/scaffold/gtm/sdr/subagents/writer.md +0 -51
- package/templates/scaffold/projects/_demo/CLAUDE.md +0 -35
- package/templates/scaffold/projects/_demo/README.md +0 -16
- package/templates/scaffold/projects/_demo/assets/.gitkeep +0 -0
- package/templates/scaffold/projects/_demo/config/default.yaml +0 -28
- package/templates/scaffold/projects/_demo/state.md +0 -11
- package/templates/scaffold/scripts/new-project.sh +0 -125
- /package/templates/scaffold/gtm/{sdr/playbook/.gitkeep → .gitkeep} +0 -0
- /package/templates/scaffold/{projects/_demo/guidelines → guidelines}/icps/_persona-template.md +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Plan-ceiling figures for `roster schedule estimate-usage` (ROS-44 / ADR-0001).
|
|
2
|
+
#
|
|
3
|
+
# Advisory estimates of interactive-session caps published by OpenAI and
|
|
4
|
+
# Anthropic. The CLI never queries vendor APIs — these numbers are read from
|
|
5
|
+
# this file at runtime and compared against projected schedule usage.
|
|
6
|
+
#
|
|
7
|
+
# Update this file as vendors publish new limits. Bump `as_of` per entry and
|
|
8
|
+
# cite the public doc URL. Schema version is immutable at 1 — bump and migrate
|
|
9
|
+
# if the shape ever changes.
|
|
10
|
+
|
|
11
|
+
version: 1
|
|
12
|
+
|
|
13
|
+
plans:
|
|
14
|
+
chatgpt-plus:
|
|
15
|
+
tool: codex
|
|
16
|
+
label: "ChatGPT Plus"
|
|
17
|
+
msgs_per_window: 250
|
|
18
|
+
window_hours: 5
|
|
19
|
+
msgs_per_week: 2100
|
|
20
|
+
source_url: "https://help.openai.com/en/articles/6643017-chatgpt-plus-faq"
|
|
21
|
+
as_of: "2026-05-18"
|
|
22
|
+
|
|
23
|
+
chatgpt-pro:
|
|
24
|
+
tool: codex
|
|
25
|
+
label: "ChatGPT Pro"
|
|
26
|
+
msgs_per_window: 1000
|
|
27
|
+
window_hours: 5
|
|
28
|
+
msgs_per_week: 8400
|
|
29
|
+
source_url: "https://help.openai.com/en/articles/8675309-chatgpt-pro"
|
|
30
|
+
as_of: "2026-05-18"
|
|
31
|
+
|
|
32
|
+
claude-pro:
|
|
33
|
+
tool: claude
|
|
34
|
+
label: "Claude Pro"
|
|
35
|
+
msgs_per_window: 45
|
|
36
|
+
window_hours: 5
|
|
37
|
+
msgs_per_week: 1200
|
|
38
|
+
source_url: "https://support.anthropic.com/en/articles/8324991-about-claude-pro-usage"
|
|
39
|
+
as_of: "2026-05-18"
|
|
40
|
+
|
|
41
|
+
claude-max-5x:
|
|
42
|
+
tool: claude
|
|
43
|
+
label: "Claude Max 5x"
|
|
44
|
+
msgs_per_window: 225
|
|
45
|
+
window_hours: 5
|
|
46
|
+
msgs_per_week: 6000
|
|
47
|
+
source_url: "https://support.anthropic.com/en/articles/9534406-about-claude-max-usage"
|
|
48
|
+
as_of: "2026-05-18"
|
|
49
|
+
|
|
50
|
+
claude-max-20x:
|
|
51
|
+
tool: claude
|
|
52
|
+
label: "Claude Max 20x"
|
|
53
|
+
msgs_per_window: 900
|
|
54
|
+
window_hours: 5
|
|
55
|
+
msgs_per_week: 24000
|
|
56
|
+
source_url: "https://support.anthropic.com/en/articles/9534406-about-claude-max-usage"
|
|
57
|
+
as_of: "2026-05-18"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firatcand/roster",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A CLI that scaffolds a structured multi-agent workspace on top of AI coding tools (Claude Code, Codex CLI, Gemini)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"skills/",
|
|
13
13
|
"agents/",
|
|
14
14
|
"templates/",
|
|
15
|
+
"data/",
|
|
15
16
|
"README.md",
|
|
16
17
|
"LICENSE"
|
|
17
18
|
],
|
|
@@ -23,9 +24,13 @@
|
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
25
|
"dev": "tsdown --watch",
|
|
25
26
|
"test": "node --test --experimental-strip-types 'test/**/*.test.ts'",
|
|
27
|
+
"test:update-golden": "node --experimental-strip-types scripts/update-golden.ts",
|
|
28
|
+
"test:update-golden:stub": "node --experimental-strip-types scripts/update-golden-stub.ts",
|
|
26
29
|
"smoke": "bash test/smoke.sh",
|
|
27
|
-
"e2e": "bash test/e2e-
|
|
28
|
-
"perf": "bash test/perf.sh"
|
|
30
|
+
"e2e:schedule": "bash test/e2e-schedule.sh",
|
|
31
|
+
"perf": "bash test/perf.sh",
|
|
32
|
+
"test:scaffold-scripts": "bash test/new-agent-slash-only.sh",
|
|
33
|
+
"probe:claude-url": "bash scripts/probe-claude-url-scheme.sh"
|
|
29
34
|
},
|
|
30
35
|
"keywords": [
|
|
31
36
|
"claude-code",
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: chief-of-staff
|
|
3
|
-
description: "
|
|
4
|
-
version: "
|
|
3
|
+
description: "Workspace maintenance for a roster v1 workspace — create agents under a function, register new functions, and audit completeness. Wraps shell scripts in scripts/. Triggers when the user asks to scaffold or audit a roster workspace, or invokes the /chief-of-staff slash command."
|
|
4
|
+
version: "1.0.0"
|
|
5
5
|
trigger_conditions:
|
|
6
6
|
- "User invokes the /chief-of-staff slash command"
|
|
7
|
-
- "User asks to
|
|
8
|
-
- "User asks
|
|
9
|
-
- "User asks for a repo or project completeness audit"
|
|
7
|
+
- "User asks to scaffold a new agent or register a new function (e.g., 'create a gtm/sdr agent', 'add a design function')"
|
|
8
|
+
- "User asks for a repo or agent completeness audit"
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
# Chief of Staff
|
|
13
12
|
|
|
14
|
-
Structural maintenance for a roster workspace. **Operate on the workspace itself**, not on the business workflows inside it. This skill scaffolds empty
|
|
13
|
+
Structural maintenance for a roster v1 workspace. **Operate on the workspace itself**, not on the business workflows inside it. This skill scaffolds empty agent and function structure and audits completeness. Filling content into the scaffolds is a separate concern handled by function-level experts and role-level agents.
|
|
15
14
|
|
|
16
|
-
When in doubt, defer to `conventions.md` in the workspace root for the canonical structure schema, and to
|
|
15
|
+
When in doubt, defer to `conventions.md` in the workspace root for the canonical structure schema, and to `scripts/new-agent.sh` for the canonical scaffold contents (heredocs inside the script are the source of truth for every generated file).
|
|
17
16
|
|
|
18
17
|
## Working directory
|
|
19
18
|
|
|
20
|
-
This skill operates from the workspace root only — the directory that contains `CLAUDE.md`, `conventions.md`, and the function dirs (`gtm/`, `product/`, etc.). If invoked from elsewhere, abort with:
|
|
19
|
+
This skill operates from the workspace root only — the directory that contains `CLAUDE.md`, `conventions.md`, `config/project.yaml`, `roster/`, and the function dirs (`gtm/`, `product/`, etc.). If invoked from elsewhere, abort with:
|
|
21
20
|
|
|
22
21
|
> Run chief-of-staff from your roster workspace root.
|
|
23
22
|
|
|
@@ -25,51 +24,42 @@ This skill operates from the workspace root only — the directory that contains
|
|
|
25
24
|
|
|
26
25
|
The user invokes via slash command or natural language. Parse intent into a plan name plus parameters. Examples:
|
|
27
26
|
|
|
28
|
-
- `/chief-of-staff create-
|
|
29
|
-
- `/chief-of-staff
|
|
27
|
+
- `/chief-of-staff create-agent gtm sdr` → `plan=create-agent function=gtm agent=sdr`
|
|
28
|
+
- `/chief-of-staff create-function design` → `plan=create-function function=design`
|
|
29
|
+
- `/chief-of-staff audit-agent product/copy-agent` → `plan=audit-agent function=product agent=copy-agent`
|
|
30
30
|
- `/chief-of-staff audit-repo` → `plan=audit-repo`
|
|
31
|
-
- "Add content-agent to _demo" → `plan=add-agent-to-project project=_demo function=gtm agent=content-agent`
|
|
32
31
|
|
|
33
32
|
When invoked without a plan, list the available plans and ask which to run.
|
|
34
33
|
|
|
34
|
+
### Out-of-scope intents
|
|
35
|
+
|
|
36
|
+
v1 is a single workspace per directory — this skill does not spin up sibling workspaces. The current workspace's identity lives in `config/project.yaml`; to start a new one, run `roster init` in a fresh directory.
|
|
37
|
+
|
|
35
38
|
## Plans
|
|
36
39
|
|
|
37
|
-
| Plan | Description |
|
|
38
|
-
|
|
39
|
-
| `create-
|
|
40
|
-
| `create-
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `remove-agent-from-project` | Archive an agent instance (preserved in `_archive`) | yes |
|
|
44
|
-
| `archive-project` | Archive a project plus all its instances | yes |
|
|
45
|
-
| `unarchive-project` | Restore an archived project | no |
|
|
46
|
-
| `rename-project` | Rename a project everywhere it appears | yes |
|
|
47
|
-
| `audit-project` | Validate a project's completeness; reports issues with suggested fixes | no |
|
|
48
|
-
| `audit-agent` | Validate an agent's structure and instances | no |
|
|
49
|
-
| `audit-repo` | Full repo audit aggregating project + agent reports | no |
|
|
40
|
+
| Plan | Description |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `create-agent` | Create a new agent under a function (interactive dialogue by default — see § "Guided agent creation"; `mode=stub` for headless) |
|
|
43
|
+
| `create-function` | Add a new function category to the registry |
|
|
44
|
+
| `audit-agent` | Validate an agent's structure |
|
|
45
|
+
| `audit-repo` | Full repo audit aggregating agent + workspace completeness reports |
|
|
50
46
|
|
|
51
47
|
Each plan lives in `chief-of-staff/plans/<plan>.yaml` in the workspace, backed by a script in `scripts/`.
|
|
52
48
|
|
|
53
49
|
## Common preamble for every plan
|
|
54
50
|
|
|
55
|
-
1. **Confirm cwd is
|
|
51
|
+
1. **Confirm cwd is workspace root.** Check for `CLAUDE.md`, `conventions.md`, `config/project.yaml`, and `roster/`. If not all present, abort with the message above.
|
|
56
52
|
2. **Parse the user's request.** Extract plan name and parameters. If ambiguous, ask before proceeding.
|
|
57
|
-
3. **Show the plan.**
|
|
53
|
+
3. **Show the plan.** Summarize exactly what will happen (paths created, modified).
|
|
58
54
|
4. **Execute by invoking the plan's backing script.** Scripts in `scripts/` do the work; this skill orchestrates and parses output. Do not duplicate the script logic.
|
|
59
|
-
5. **Report.** Summarize what changed (paths created, modified
|
|
55
|
+
5. **Report.** Summarize what changed (paths created, modified). Note anything skipped or any warnings.
|
|
60
56
|
6. **Never auto-commit to git.** Leave commits for the user.
|
|
61
57
|
|
|
62
|
-
## Mandatory confirmation gates
|
|
63
|
-
|
|
64
|
-
Destructive plans (`archive-project`, `unarchive-project`, `rename-project`, `remove-agent-from-project`) MUST display the planned changes and ask `proceed?` before executing.
|
|
65
|
-
|
|
66
|
-
Cross-link prompts during `create-project` (which agents to instance) and `create-agent` (which projects to instance into) are also session-only — they cannot be answered headlessly. Power users skip the prompt by passing `agents=` or `add-to-projects=` inline.
|
|
67
|
-
|
|
68
58
|
## Guided agent creation
|
|
69
59
|
|
|
70
60
|
The `create-agent` plan runs in one of two modes (see `chief-of-staff/plans/create-agent.yaml`):
|
|
71
61
|
|
|
72
|
-
- **stub** — byte-identical to `bash scripts/new-agent.sh
|
|
62
|
+
- **stub** — byte-identical to `bash scripts/new-agent.sh` in its non-interactive path (`AGENT_TEAM_NO_CONFIRM=1` or no TTY). Writes an `agent.md` whose grounded/uncertain fields carry `<placeholder>` text verbatim from the script's heredocs, plus `config.yaml` with `tools: {}` and an empty `plans/.gitkeep`. The script's interactive `## Tools and bindings` prompt is skipped, so that section is absent from `agent.md` in stub mode. Used in CI, headless contexts, and as the legacy escape hatch.
|
|
73
63
|
- **guided** — runs the 5-phase dialogue defined below to produce a filled-in `agent.md` from prose intake plus targeted follow-ups. Same on-disk layout as stub mode, but with real content instead of placeholders.
|
|
74
64
|
|
|
75
65
|
Mode selection priority (first match wins): `${inputs.mode}` → `AGENT_TEAM_NO_CONFIRM=1` (→ `stub`) → TTY detection (TTY → `guided`, no TTY → `stub`).
|
|
@@ -78,7 +68,7 @@ Mode selection priority (first match wins): `${inputs.mode}` → `AGENT_TEAM_NO_
|
|
|
78
68
|
|
|
79
69
|
> The skill MUST NOT write a Step, Subagent, Tool, Plan body, or Failure mode unless that content was supplied by the user (in prose or follow-up) or comes from documented convention. If the skill catches itself about to invent content, it stops and asks instead.
|
|
80
70
|
|
|
81
|
-
This invariant is load-bearing. Guided mode is **not a content generator** — it is a structured interviewer that organizes what the user said into the canonical `agent.md` shape. Every non-boilerplate line in the generated agent.md must be traceable to either (a) the prose intake, (b) a follow-up answer, or (c) a documented convention in `conventions.md` / `
|
|
71
|
+
This invariant is load-bearing. Guided mode is **not a content generator** — it is a structured interviewer that organizes what the user said into the canonical `agent.md` shape. Every non-boilerplate line in the generated agent.md must be traceable to either (a) the prose intake, (b) a follow-up answer, or (c) a documented convention in `conventions.md` / `scripts/new-agent.sh`. Never fill in plausible-looking defaults to make the output feel complete — gaps stay gaps, surfaced explicitly as follow-up questions.
|
|
82
72
|
|
|
83
73
|
### EXPERT.md auto-load
|
|
84
74
|
|
|
@@ -101,9 +91,9 @@ Accept the answer as-is — no structure required. Capture it verbatim; it seeds
|
|
|
101
91
|
|
|
102
92
|
Partition every required `agent.md` field into one of three buckets:
|
|
103
93
|
|
|
104
|
-
- **boilerplate** — filled silently from `conventions.md` / `
|
|
94
|
+
- **boilerplate** — filled silently from `conventions.md` / `scripts/new-agent.sh` heredocs. Examples: standard "Read at runtime" file paths, the lessons-protocol paragraph, the `approval_channel: auto` default, the canonical "Confirmation gate denied" failure mode wording.
|
|
105
95
|
- **grounded** — drafted directly from the prose intake. Examples: the `Purpose` paragraph, the `Outputs` description, the agent's headline role.
|
|
106
|
-
- **uncertain** — content the prose did not specify and convention cannot fill. Examples: which subagents exist, which tools/MCPs are needed,
|
|
96
|
+
- **uncertain** — content the prose did not specify and convention cannot fill. Examples: which subagents exist, which tools/MCPs are needed, agent-specific failure modes, plan names.
|
|
107
97
|
|
|
108
98
|
Boilerplate is written without asking. Grounded is drafted but explicitly flagged in the Phase 4 preview ("drafted from your prose — review before accepting"). Uncertain becomes the queue for Phase 3.
|
|
109
99
|
|
|
@@ -125,21 +115,167 @@ Continue until the uncertain bucket is empty.
|
|
|
125
115
|
Render the full draft tree to the user. Show:
|
|
126
116
|
|
|
127
117
|
- Every file path that will be written, with a one-line description.
|
|
128
|
-
- The full `agent.md` content (purpose, inputs,
|
|
118
|
+
- The full `agent.md` content (purpose, inputs, subagents, tools-and-bindings, outputs, approval, lessons, failure modes — per `templates/scaffold/conventions.md`; workflow logic lives in plans, not in `agent.md`).
|
|
129
119
|
- The slash-command description that will land in `.claude/commands/<agent>.md` (replacing the stub's `TODO: fill in description` placeholder).
|
|
130
|
-
- The `plans/` directory (
|
|
120
|
+
- The `plans/` directory (`.gitkeep` only — the user writes the first plan in `plans/<plan>.yaml` as a next step after the agent tree lands).
|
|
131
121
|
|
|
132
122
|
Offer three controls:
|
|
133
123
|
|
|
134
124
|
- **`y`** → proceed to Phase 5 (atomic write).
|
|
135
|
-
- **`revise <section>`** → re-enter Phase 3 for that section only, then re-render the preview. Valid sections: `purpose`, `inputs`, `
|
|
125
|
+
- **`revise <section>`** → re-enter Phase 3 for that section only, then re-render the preview. Valid sections: `purpose`, `inputs`, `subagents`, `tools`, `outputs`, `approval`, `failure-modes`, `slash-command` (the keyword `tools` revises the `## Tools and bindings` section). After collecting the revised answers, the skill re-renders the **full** preview (not just the changed section) so the user sees the final state in one place.
|
|
136
126
|
- **`cancel`** → abort with no writes. Print: `Cancelled. No files written.`
|
|
137
127
|
|
|
138
128
|
Loop on `revise` until the user types `y` or `cancel`. There is no implicit "looks good enough" — explicit acceptance is required.
|
|
139
129
|
|
|
140
130
|
### Phase 5 — Atomic write
|
|
141
131
|
|
|
142
|
-
|
|
132
|
+
Transitions from accepted Phase 4 preview (`y`) to files-on-disk. The **agent tree** at `<fn>/<agent>/` (Steps 4–5) is written as a single transaction — either every staged file in the tree lands, or nothing does. The **slash command** at `<repo-root>/.claude/commands/<agent>.md` (Step 6) is a separate post-tree write: it can fail or be interrupted independently and is recovered via `--slash-only` retry rather than rollback.
|
|
133
|
+
|
|
134
|
+
#### Transaction state
|
|
135
|
+
|
|
136
|
+
- `draft: Map<absolute_path, string>` — in-memory file map (every path the write will create, with final content). Built incrementally during Phase 2/3 as fields are populated.
|
|
137
|
+
- `dirs: List<absolute_path>` — directories to create, enumerated explicitly (no implicit ancestors). Listed parent-before-child so the corresponding `rmdir` walk in Step 7 can go deepest-first.
|
|
138
|
+
- `rollback: List<absolute_path>` — every newly-created path (file or directory), appended in creation order. Includes every directory in `dirs`, every file from `draft` once its write is attempted, and nothing else. Drives reverse-order cleanup on failure.
|
|
139
|
+
|
|
140
|
+
#### Step 1 — Pre-write invariant check
|
|
141
|
+
|
|
142
|
+
Run all four invariants from § "Cross-file invariants" against `draft`. On any failure:
|
|
143
|
+
|
|
144
|
+
> Invariant N failed: <specific failure>. Revise the affected section, or `cancel` to abort without writing.
|
|
145
|
+
|
|
146
|
+
Re-enter Phase 3 for the offending section. The atomic-write transaction NEVER proceeds with a tripped invariant — no partial state can leak onto disk.
|
|
147
|
+
|
|
148
|
+
Per `templates/scaffold/conventions.md`, workflow logic lives in plan YAMLs, not in `agent.md` — and the create-agent plan does not auto-write the first plan (the user writes it as a next step). The pre-write check therefore validates only the agent tree, not any `plans/<plan>.yaml` content.
|
|
149
|
+
|
|
150
|
+
#### Step 2 — Final user preview
|
|
151
|
+
|
|
152
|
+
Confirm once more: `Write this? (y/revise/cancel)`. Re-render the full Phase 4 preview only if the user typed `revise` since the last render. On `cancel` print `Cancelled. No files written.` and exit. On `y` proceed to Step 3.
|
|
153
|
+
|
|
154
|
+
#### Step 3 — Install SIGINT trap
|
|
155
|
+
|
|
156
|
+
Install a signal handler covering **Steps 4–5 only** (the agent-tree transaction). On Ctrl+C: run the rollback sequence (Step 7) best-effort, then append a Step 8 log entry with `outcome: interrupted` (best-effort — log failure is non-fatal), then exit non-zero. After cleanup, print either:
|
|
157
|
+
|
|
158
|
+
> Interrupted. Rolled back N files. Workspace is clean.
|
|
159
|
+
|
|
160
|
+
or, if cleanup itself partially fails:
|
|
161
|
+
|
|
162
|
+
> Interrupted. Cleanup incomplete — these paths remain on disk:
|
|
163
|
+
> `<path>`
|
|
164
|
+
> `<path>`
|
|
165
|
+
> Remove manually before retrying.
|
|
166
|
+
|
|
167
|
+
Uninstall the trap **before** entering Step 6. Once the agent tree is canonical (i.e., `agent.md` has landed), a SIGINT during Step 6 is treated as a slash-command failure, not as cause for rollback — the agent tree is preserved and the user can recover with `--slash-only` (Step 6 retry guidance).
|
|
168
|
+
|
|
169
|
+
#### Step 4 — Create directory tree
|
|
170
|
+
|
|
171
|
+
Enumerate every directory the transaction creates **explicitly** (no `mkdir -p` shortcut that hides intermediate ancestors from the cleanup walker — Step 7 needs to remove them). Create them one at a time, parent-before-child, appending each to `rollback`:
|
|
172
|
+
|
|
173
|
+
- `<fn>/<agent>/`
|
|
174
|
+
- `<fn>/<agent>/subagents/`
|
|
175
|
+
- `<fn>/<agent>/playbook/`
|
|
176
|
+
- `<fn>/<agent>/pending/`
|
|
177
|
+
- `<fn>/<agent>/logs/`
|
|
178
|
+
- `<fn>/<agent>/logs/runs/`
|
|
179
|
+
- `<fn>/<agent>/logs/feedback/`
|
|
180
|
+
- `<fn>/<agent>/.claude/`
|
|
181
|
+
- `<fn>/<agent>/.claude/skills/`
|
|
182
|
+
- `<fn>/<agent>/.claude/plugins/`
|
|
183
|
+
- `<fn>/<agent>/plans/`
|
|
184
|
+
|
|
185
|
+
If a directory already exists at the moment we try to create it (e.g., racing process, or `<fn>/` exists from a prior function), do NOT append it to `rollback` — pre-existing paths are not ours to delete. Skip and continue. The parent `<fn>/` itself is never in `rollback` for the same reason (it predates this transaction or was created as `<fn>/<agent>/`'s implicit parent — see invariant: if `<fn>/` does not exist, abort the whole transaction before Step 4 and ask the user to register the function via `create-function` first).
|
|
186
|
+
|
|
187
|
+
If a directory creation fails for any other reason (permissions, ENOSPC), skip to Step 7 with `rollback` populated up to the failure point.
|
|
188
|
+
|
|
189
|
+
#### Step 5 — Write files in deterministic order
|
|
190
|
+
|
|
191
|
+
Write each file from `draft`. Append every written path to `rollback` **before** the write begins, so a write-failure mid-byte still leaves the partial file in the cleanup set.
|
|
192
|
+
|
|
193
|
+
Order:
|
|
194
|
+
|
|
195
|
+
1. `<fn>/<agent>/README.md`
|
|
196
|
+
2. `<fn>/<agent>/.mcp.json`
|
|
197
|
+
3. `<fn>/<agent>/.claude/settings.json`
|
|
198
|
+
4. `<fn>/<agent>/subagents/_template.md`
|
|
199
|
+
5. `<fn>/<agent>/subagents/<name>.md` (one per `agent.md ## Subagents` entry; zero files if none named)
|
|
200
|
+
6. `<fn>/<agent>/plans/.gitkeep`
|
|
201
|
+
7. `<fn>/<agent>/config.yaml`
|
|
202
|
+
8. `<fn>/<agent>/asset-references.md`
|
|
203
|
+
9. `<fn>/<agent>/playbook/.gitkeep`
|
|
204
|
+
10. `<fn>/<agent>/pending/.gitkeep`
|
|
205
|
+
11. `<fn>/<agent>/logs/runs/.gitkeep`
|
|
206
|
+
12. `<fn>/<agent>/logs/feedback/.gitkeep`
|
|
207
|
+
13. `<fn>/<agent>/.claude/skills/.gitkeep`
|
|
208
|
+
14. `<fn>/<agent>/.claude/plugins/.gitkeep`
|
|
209
|
+
15. `<fn>/<agent>/agent.md` ← **LAST. Canonical contract.**
|
|
210
|
+
|
|
211
|
+
**Why `agent.md` last:** It is the canonical orchestrator contract — the file roster's commands grep for to detect an agent's existence. Writing it last guarantees that any process **keyed off the existence of `agent.md`** observes either no agent or a complete one. A mid-Step-5 crash leaves either no `agent.md` at all, or — after Step 7 rollback — an empty `<fn>/<agent>/` parent that no contract-aware reader will treat as a valid agent.
|
|
212
|
+
|
|
213
|
+
This is a **path-level / discovery-keyed** guarantee, not a process-isolation guarantee. A third party that opens a path mid-write retains an open file descriptor through rollback, and a directory listing of `<fn>/<agent>/` mid-Step-4/5 can show a partial tree (this is why discovery should always key off `agent.md`, never directory enumeration).
|
|
214
|
+
|
|
215
|
+
On any write failure mid-Step-5, skip to Step 7. `rollback` already contains every path attempted, including the partially-written file at the failure point.
|
|
216
|
+
|
|
217
|
+
**Note — divergence from stub mode:** `scripts/new-agent.sh` (stub mode) writes `agent.md` first as a single shell-script side effect; the script is not transactional. Guided mode adopts the safer LAST-ordering to make the canonical-contract invariant hold. The two paths are intentionally different — do not "fix" one to match the other.
|
|
218
|
+
|
|
219
|
+
#### Step 6 — Write slash command (outside rollback root)
|
|
220
|
+
|
|
221
|
+
The SIGINT trap from Step 3 is uninstalled before this step begins. Write `<repo-root>/.claude/commands/<agent>.md`. This path is **outside** `<fn>/<agent>/`, so it is **not** in the `rollback` list — neither a write failure nor a Ctrl+C during Step 6 triggers a rollback of the agent tree.
|
|
222
|
+
|
|
223
|
+
On failure (or SIGINT during Step 6 leaves a partial file), print:
|
|
224
|
+
|
|
225
|
+
> Agent tree at `<fn>/<agent>/` written successfully, but slash command `.claude/commands/<agent>.md` failed: `<error>`. Retry with:
|
|
226
|
+
> `bash scripts/new-agent.sh --slash-only <fn> <agent>`
|
|
227
|
+
|
|
228
|
+
The `--slash-only` flag (added in P4-T05) accepts the same two positional args and writes ONLY the slash command — no other side effects, no prompts. Required because the agent tree is already canonical at this point; re-running the full plan would refuse on the existing directory. Caveats for retry:
|
|
229
|
+
|
|
230
|
+
- If the slash command file already exists at retry time (e.g., partial write from Step 6 failure or SIGINT), `--slash-only` refuses to clobber per P4-T05 acceptance — remove the existing file first, then retry.
|
|
231
|
+
- `--slash-only` does NOT verify that `<fn>/<agent>/agent.md` exists. If the agent tree was rolled back before retry, the slash command will be a dangling pointer. Re-run the full `create-agent` plan instead in that case.
|
|
232
|
+
|
|
233
|
+
#### Step 7 — Rollback (failure path)
|
|
234
|
+
|
|
235
|
+
Triggered by any error in Steps 4–5, or by SIGINT during Steps 4–5 (Step 3 trap). Step 6 failures and Step-6 SIGINT are **not** rollback triggers — they are surfaced for `--slash-only` retry instead.
|
|
236
|
+
|
|
237
|
+
Sequence:
|
|
238
|
+
|
|
239
|
+
1. Walk `rollback` in reverse order (newest first). For each path:
|
|
240
|
+
- If it is a file (or partially-written file), `unlink` it.
|
|
241
|
+
- If it is a directory, `rmdir` it (no `-r`). It will succeed because all of its children were created later than it and have already been removed by this walk. If `rmdir` fails because something unexpected exists (race, manual write), record the path as residual and continue.
|
|
242
|
+
2. After the walk, `<fn>/<agent>/` itself is either gone (if `rollback` included it and the walk reached it) or remains with residual content. Do NOT attempt a recursive delete — if anything remains, it is either pre-existing (not ours) or unexpected (worth surfacing).
|
|
243
|
+
3. Print:
|
|
244
|
+
> Write failed at `<path>`: `<error>`. Rolled back N paths (M files, K directories).
|
|
245
|
+
|
|
246
|
+
If `<fn>/<agent>/` was removed:
|
|
247
|
+
> Workspace is clean.
|
|
248
|
+
|
|
249
|
+
Else:
|
|
250
|
+
> Workspace still contains `<fn>/<agent>/` with N residual paths:
|
|
251
|
+
> `<path>`
|
|
252
|
+
> `<path>`
|
|
253
|
+
> Remove manually before retrying.
|
|
254
|
+
4. Append a Step 8 log entry with `outcome: rollback` and the residual-paths list, then exit non-zero.
|
|
255
|
+
|
|
256
|
+
#### Step 8 — Operation log
|
|
257
|
+
|
|
258
|
+
Always append exactly one log entry per `create-agent` invocation to `chief-of-staff/logs/<YYYY-MM>/operations-<YYYY-MM-DD>.md`. Trigger points:
|
|
259
|
+
|
|
260
|
+
| Operation outcome | When Step 8 fires | `outcome` value |
|
|
261
|
+
| --- | --- | --- |
|
|
262
|
+
| Steps 4–6 all succeed | end of Step 6 | `success` |
|
|
263
|
+
| Step 5/4 write failure | end of Step 7 rollback walk | `rollback` |
|
|
264
|
+
| Step 6 write failure (agent tree canonical, slash failed) | after the user-facing retry message in Step 6 | `partial-slash-failure` |
|
|
265
|
+
| SIGINT during Steps 4–5 | inside the trap, after the Step 7 rollback walk | `interrupted` |
|
|
266
|
+
| SIGINT during Step 6 (agent tree canonical, slash partial) | after Step 6 retry message | `partial-slash-failure` (with a note that the slash file may be partial) |
|
|
267
|
+
|
|
268
|
+
Schema:
|
|
269
|
+
|
|
270
|
+
- `timestamp` (UTC ISO-8601)
|
|
271
|
+
- `plan: create-agent`
|
|
272
|
+
- `mode: guided | stub`
|
|
273
|
+
- `inputs: <fn>, <agent>`
|
|
274
|
+
- `outcome: success | rollback | partial-slash-failure | interrupted`
|
|
275
|
+
- `residual_paths:` (only present when outcome is `rollback` or `interrupted`; empty list if cleanup was complete)
|
|
276
|
+
- `candidate_lessons:` (optional, per § "Lessons protocol")
|
|
277
|
+
|
|
278
|
+
The log file is append-only. If `chief-of-staff/logs/<YYYY-MM>/` doesn't exist, create it during Step 8. This write is **outside** the transaction — a log-write failure does NOT trigger rollback of a successful agent creation; surface a stderr warning instead.
|
|
143
279
|
|
|
144
280
|
## Generated file contracts
|
|
145
281
|
|
|
@@ -147,11 +283,13 @@ Every file the guided plan writes has a per-file content contract. Stub mode pro
|
|
|
147
283
|
|
|
148
284
|
| File | Guided-mode contract | Stub-mode contract |
|
|
149
285
|
| --- | --- | --- |
|
|
150
|
-
| `agent.md` | See per-section disposition below. Populated and grounded fields filled from prose + Phase 3 answers; boilerplate fields filled from `
|
|
151
|
-
| `
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
| `README.md`, `.mcp.json`, `.claude/settings.json`, `
|
|
286
|
+
| `agent.md` | See per-section disposition below. Populated and grounded fields filled from prose + Phase 3 answers; boilerplate fields filled from `scripts/new-agent.sh` heredocs and `conventions.md`. Zero literal `<placeholder>` strings remain (explicit `TODO: <gap>` markers allowed only where the user deferred during Phase 3). | Identical to `bash scripts/new-agent.sh` output: every grounded/uncertain field carries its `<placeholder>` text verbatim. |
|
|
287
|
+
| `subagents/<name>.md` | One file per name listed in `agent.md ## Subagents`. All **six** required sections present and populated: `Role`, `Inputs`, `Output`, `Tools`, `Boundaries`, `Quality bar`. **Never half-populate a subagent.** If a section cannot be populated from prose / follow-ups, either remove the subagent from `agent.md ## Subagents` entirely or Phase 3 re-asks. `subagents/_template.md` is also written byte-for-byte from the `scripts/new-agent.sh` heredoc (same as stub mode). | `subagents/_template.md` only. No per-name files. |
|
|
288
|
+
| `.claude/commands/<agent>.md` | `description:` field is a real sentence: ≤ 80 chars, contains no `<` character, and contains no literal `TODO:` substring. The body matches the canonical routing-logic template emitted by `write_slash_command` in `scripts/new-agent.sh`, with `<agent>` and `<function>` substituted. | `description: <function> agent — TODO: fill in description`. Canonical body otherwise unchanged. |
|
|
289
|
+
| `config.yaml` | Stub mode writes `tools: {}` (empty). Guided mode mirrors the `## Tools and bindings` block from the generated `agent.md` into the `tools:` map per `templates/scaffold/conventions.md` § "Tool bindings"; every named tool has an `env_var`, `required`, and `description` entry (TODO placeholders allowed only where the user deferred). | `tools: {}`. |
|
|
290
|
+
| `README.md`, `.mcp.json`, `.claude/settings.json`, `asset-references.md`, every `.gitkeep` | Identical to stub mode — byte-for-byte. These files do not vary by mode. | (canonical) |
|
|
291
|
+
|
|
292
|
+
> Plan YAMLs are not in this table — `create-agent` does not write `plans/<plan>.yaml`. The user authors plans as a next step after the agent tree lands.
|
|
155
293
|
|
|
156
294
|
### `agent.md` per-section disposition
|
|
157
295
|
|
|
@@ -161,24 +299,22 @@ For each section of the agent.md template (the structure emitted by `scripts/new
|
|
|
161
299
|
| --- | --- |
|
|
162
300
|
| `## Purpose` | **grounded** — drafted from the Phase 1 prose. |
|
|
163
301
|
| `## Inputs` — orchestrator-expected list | **grounded** — drafted from prose + Phase 3 answers about what triggers a run. |
|
|
164
|
-
| `## Inputs` — "Read at runtime" list | **boilerplate** — canonical paths from `conventions.md` (agent.md,
|
|
165
|
-
| `## Steps` | **grounded** — every step comes from prose / Phase 3. Must have matching ids in `plans/<plan>.yaml`. |
|
|
302
|
+
| `## Inputs` — "Read at runtime" list | **boilerplate** — canonical paths from `conventions.md` (agent.md, agent `config.yaml`, workspace `CLAUDE.md`, workspace `guidelines/`, playbooks, recent runs). |
|
|
166
303
|
| `## Subagents` | **uncertain → guided** — Phase 3 collects the subagent list (or empty). Each named subagent gets a fully populated `subagents/<name>.md`. |
|
|
167
|
-
| `## Tools` | **uncertain → guided** — Phase 3 collects tool / MCP names. Each tool
|
|
304
|
+
| `## Tools and bindings` | **uncertain → guided** — Phase 3 collects tool / MCP names. Each named tool gets a bindings entry (invariant 2). Section is omitted entirely when the user defines no tools. |
|
|
168
305
|
| `## Outputs` | **boilerplate + grounded** — canonical run-file path is boilerplate; the artifact description is grounded from prose. |
|
|
169
306
|
| `## Approval` | **boilerplate** — `approval_channel: auto` line with the standard Slack / HITL routing paragraph. |
|
|
170
307
|
| `## Lessons protocol` | **boilerplate** — canonical paragraph, identical in every agent. |
|
|
171
|
-
| `## Failure modes` | **boilerplate + uncertain** — standard failures (cwd wrong, slug invalid, script fails) are boilerplate;
|
|
308
|
+
| `## Failure modes` | **boilerplate + uncertain** — standard failures (cwd wrong, slug invalid, script fails) are boilerplate; agent-specific failures come from Phase 3. |
|
|
172
309
|
|
|
173
310
|
### Cross-file invariants
|
|
174
311
|
|
|
175
|
-
|
|
312
|
+
Four invariants MUST pass during the pre-write check (Phase 5). Any failure aborts the write — no partial state is committed to the workspace — and the user is shown which invariant tripped and offered the chance to revise the relevant section.
|
|
176
313
|
|
|
177
314
|
1. **Subagent files match the declared list.** Every subagent named in `agent.md ## Subagents` has a populated file at `subagents/<name>.md` with all six required sections. Conversely, every file under `subagents/` other than `_template.md` is named in `agent.md ## Subagents`. Neither side may carry an orphan.
|
|
178
|
-
2. **
|
|
179
|
-
3. **
|
|
180
|
-
4. **
|
|
181
|
-
5. **No unfilled placeholders in agent.md.** `agent.md` contains zero literal `<placeholder>` strings (i.e., no `<...>` patterns from the stub template). Explicit `TODO: <gap>` comments are allowed only where the user deferred during Phase 3; they must include a specific gap description, not a bare `TODO:`.
|
|
315
|
+
2. **Every named tool has a bindings entry.** Every tool listed in the `## Tools and bindings` block of `agent.md` has a non-`TODO` `required` flag and a non-empty `description`. The same set is mirrored into `config.yaml` under `tools:` (per `templates/scaffold/conventions.md` § "Tool bindings").
|
|
316
|
+
3. **Slash-command description is real.** The `description:` field in `.claude/commands/<agent>.md` is ≤ 80 characters, contains no `<` character, and contains no literal `TODO:` substring.
|
|
317
|
+
4. **No unfilled placeholders in agent.md.** `agent.md` contains zero literal `<placeholder>` strings (i.e., no `<...>` patterns from the stub template). Explicit `TODO: <gap>` comments are allowed only where the user deferred during Phase 3; they must include a specific gap description, not a bare `TODO:`.
|
|
182
318
|
|
|
183
319
|
On invariant failure, the skill prints:
|
|
184
320
|
|
|
@@ -188,14 +324,14 @@ Then re-enters Phase 3 for the section that owns the tripped invariant. The atom
|
|
|
188
324
|
|
|
189
325
|
## Outputs
|
|
190
326
|
|
|
191
|
-
- **Mutation plans:** Summary printed to chat (paths created,
|
|
327
|
+
- **Mutation plans:** Summary printed to chat (paths created, modified). The backing script also appends to `chief-of-staff/logs/<YYYY-MM>/operations-<YYYY-MM-DD>.md` (one log file per day, append-only).
|
|
192
328
|
- **Audit plans:** A report file at `chief-of-staff/logs/<YYYY-MM>/audit-...-<YYYY-MM-DD-HHMM>.md`, plus a condensed stdout summary.
|
|
193
329
|
|
|
194
330
|
Per-plan output schemas are declared in each plan's `outputs:` block in its YAML.
|
|
195
331
|
|
|
196
332
|
## Lessons protocol
|
|
197
333
|
|
|
198
|
-
If you observe a recurring pattern during operations (e.g., users forgetting to
|
|
334
|
+
If you observe a recurring pattern during operations (e.g., users forgetting to fill `config/project.yaml` before running `create-agent`), log it inline in the operation's log entry under a `## Candidate lessons` section. The dreamer picks it up on the next reflection pass.
|
|
199
335
|
|
|
200
336
|
Never write directly to `chief-of-staff/playbook/` during operations. The user may write a lesson by hand with `source: human`; those are respected.
|
|
201
337
|
|
|
@@ -204,15 +340,19 @@ Never write directly to `chief-of-staff/playbook/` during operations. The user m
|
|
|
204
340
|
- **Cwd not workspace root** → abort with clear message
|
|
205
341
|
- **Invalid slug or function name** → abort with an example of valid format
|
|
206
342
|
- **Collision (target already exists)** → abort, tell the user the existing path
|
|
207
|
-
- **Missing dependency** (e.g.,
|
|
343
|
+
- **Missing dependency** (e.g., function not registered when running `create-agent` — run `create-function` first) → abort, suggest the prerequisite plan
|
|
208
344
|
- **Script fails** → surface the script's stderr; do not attempt to recover by doing the work directly
|
|
209
345
|
- **YAML/JSON parse error in audit** → report as failure with the line number from the audit script
|
|
210
346
|
- **Confirmation gate denied** → abort cleanly, no changes
|
|
211
347
|
- **Partial failure mid-operation** → scripts handle their own rollback. If a script reports partial state, surface exactly what state the repo is in and what to do next.
|
|
348
|
+
- **Atomic write rollback ran** (guided mode, Steps 4–5 failure) → all `rollback` paths deleted, parent `<fn>/<agent>/` removed if empty. Surface residual paths if any deletion failed; exit non-zero.
|
|
349
|
+
- **SIGINT during atomic write** → trap runs Step 7 best-effort; partial cleanup state disclosed. User must remove residual paths before retrying.
|
|
350
|
+
- **Slash command failed after agent tree success** (Step 6) → agent tree is canonical and kept. Surface the failure with the `--slash-only <fn> <agent>` retry command. Not a rollback trigger.
|
|
351
|
+
- **Operation log write failed after successful agent creation** (Step 8) → log a warning to stderr; do NOT roll back the agent. Logs are best-effort and outside the transaction.
|
|
212
352
|
|
|
213
353
|
## What this skill does NOT do
|
|
214
354
|
|
|
215
355
|
- Run business workflows (SDR outreach, design generation, content authoring). Those are separate role-level skills.
|
|
216
|
-
- Edit guidelines, ICPs, voice, or any
|
|
356
|
+
- Edit guidelines, ICPs, voice, or any workspace content. That's expert-level work.
|
|
217
357
|
- Make git commits. Always leave commits for the user.
|
|
218
358
|
- Touch files outside the workspace.
|
package/skills/dreamer/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dreamer
|
|
3
|
-
description: "Off-hours reflection agent. Reads recent runs and feedback across all agents
|
|
3
|
+
description: "Off-hours reflection agent. Reads recent runs and feedback across all agents, detects recurring patterns, drafts lesson candidates, routes through HITL approval, and writes approved lessons to the agent's playbook. The only agent that writes to playbook files. Triggers when the user invokes /dreamer or asks to consolidate lessons from past work."
|
|
4
4
|
version: "0.1.0"
|
|
5
5
|
trigger_conditions:
|
|
6
6
|
- "User invokes the /dreamer slash command"
|
|
@@ -13,7 +13,7 @@ trigger_conditions:
|
|
|
13
13
|
|
|
14
14
|
## Purpose
|
|
15
15
|
|
|
16
|
-
Reinforcement and consolidation. Reads recent runs, feedback, and post-hoc analytics across all agents
|
|
16
|
+
Reinforcement and consolidation. Reads recent runs, feedback, and post-hoc analytics across all agents. Detects patterns. Drafts lesson candidates. Routes through HITL approval. On approval, the candidate file moves from `<function>/<agent>/pending/` to `<function>/<agent>/playbook/`.
|
|
17
17
|
|
|
18
18
|
This is the only agent allowed to write to `playbook/` files (apart from the user writing by hand with `source: human`).
|
|
19
19
|
|
|
@@ -34,7 +34,7 @@ Read at runtime:
|
|
|
34
34
|
- `dreamer/plans/<plan>.yaml` — the workflow recipe
|
|
35
35
|
- `dreamer/state.md` — last processed cutoff and run summary
|
|
36
36
|
- `dreamer/pending/` — queued candidates awaiting Slack approval
|
|
37
|
-
- All `<function>/<agent>/
|
|
37
|
+
- All `<function>/<agent>/logs/runs/` and `<function>/<agent>/logs/feedback/` for material since the cutoff
|
|
38
38
|
- Existing playbook lessons for evidence comparison
|
|
39
39
|
|
|
40
40
|
## Plans
|
|
@@ -56,11 +56,10 @@ Typically scheduled nightly via cron or `/schedule`. When invoked without a plan
|
|
|
56
56
|
|
|
57
57
|
- `pattern-detector.md` — finds patterns across runs+feedback
|
|
58
58
|
- `lesson-drafter.md` — drafts a single lesson in schema format
|
|
59
|
-
- `promotion-arbiter.md` — decides project vs global scope for validated lessons
|
|
60
59
|
|
|
61
60
|
## Tools and bindings
|
|
62
61
|
|
|
63
|
-
- File reads across the entire repo (the one agent that crawls broadly) — no
|
|
62
|
+
- File reads across the entire repo (the one agent that crawls broadly) — no external tool bindings
|
|
64
63
|
- `Slack` MCP — for HITL posting (from universal `.mcp.json`); HITL channel resolved via `SLACK_HITL_CHANNEL_ADMIN` env var
|
|
65
64
|
- No external APIs needed beyond Slack
|
|
66
65
|
|
|
@@ -68,7 +67,7 @@ Typically scheduled nightly via cron or `/schedule`. When invoked without a plan
|
|
|
68
67
|
|
|
69
68
|
Run file at `dreamer/logs/<YYYY-MM>/<YYYY-MM-DD-HHMM>.md` containing:
|
|
70
69
|
|
|
71
|
-
- Material processed (counts by
|
|
70
|
+
- Material processed (counts by agent)
|
|
72
71
|
- Patterns detected
|
|
73
72
|
- Lesson candidates drafted (Slack thread links)
|
|
74
73
|
- Promotion candidates
|
|
@@ -81,6 +80,8 @@ State file at `dreamer/state.md` tracking last successful run timestamp + summar
|
|
|
81
80
|
|
|
82
81
|
`approval_channel: slack` always. The dreamer typically runs nightly via cron — there's no interactive caller.
|
|
83
82
|
|
|
83
|
+
On approval, the candidate file in `<agent>/pending/` moves to `<agent>/playbook/`. There is no scope decision and no arbiter — v1 has a single playbook per agent.
|
|
84
|
+
|
|
84
85
|
TTL: 7 days. Unapproved candidates roll forward in `dreamer/pending/`. After 7 days, marked stale and require re-evaluation.
|
|
85
86
|
|
|
86
87
|
## Pattern detection signals
|
|
@@ -108,5 +109,5 @@ The dreamer writes lessons FOR other agents. It does not write lessons about its
|
|
|
108
109
|
|
|
109
110
|
- **No new material**: log no-op run, exit cleanly
|
|
110
111
|
- **Slack unavailable**: queue candidates locally in `dreamer/pending/`, retry next run
|
|
111
|
-
- **Conflicting lessons across
|
|
112
|
+
- **Conflicting lessons across agents**: do NOT auto-merge. Surface conflict; HITL decides.
|
|
112
113
|
- **Threshold not met**: keep candidate in `observing` status, accumulate evidence next pass
|