@firatcand/roster 0.1.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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +272 -0
  3. package/agents/critic.md +74 -0
  4. package/agents/enricher.md +56 -0
  5. package/agents/lesson-drafter.md +64 -0
  6. package/agents/pattern-detector.md +62 -0
  7. package/agents/promotion-arbiter.md +71 -0
  8. package/agents/prospector.md +51 -0
  9. package/agents/writer.md +58 -0
  10. package/bin/roster.js +2093 -0
  11. package/lib/.gitkeep +0 -0
  12. package/package.json +68 -0
  13. package/skills/chief-of-staff/SKILL.md +218 -0
  14. package/skills/dreamer/SKILL.md +112 -0
  15. package/skills/roster-orchestrator/SKILL.md +122 -0
  16. package/skills/sdr/SKILL.md +147 -0
  17. package/templates/CLAUDE.project.template.md +45 -0
  18. package/templates/CONTEXT.template.md +51 -0
  19. package/templates/env.example +25 -0
  20. package/templates/gitignore-defaults.txt +28 -0
  21. package/templates/scaffold/.config/functions.yaml +22 -0
  22. package/templates/scaffold/chief-of-staff/README.md +86 -0
  23. package/templates/scaffold/chief-of-staff/agent.md +122 -0
  24. package/templates/scaffold/chief-of-staff/logs/.gitkeep +0 -0
  25. package/templates/scaffold/chief-of-staff/plans/add-agent-to-project.yaml +45 -0
  26. package/templates/scaffold/chief-of-staff/plans/archive-project.yaml +51 -0
  27. package/templates/scaffold/chief-of-staff/plans/audit-agent.yaml +32 -0
  28. package/templates/scaffold/chief-of-staff/plans/audit-project.yaml +34 -0
  29. package/templates/scaffold/chief-of-staff/plans/audit-repo.yaml +26 -0
  30. package/templates/scaffold/chief-of-staff/plans/create-agent.yaml +123 -0
  31. package/templates/scaffold/chief-of-staff/plans/create-function.yaml +48 -0
  32. package/templates/scaffold/chief-of-staff/plans/create-project.yaml +65 -0
  33. package/templates/scaffold/chief-of-staff/plans/remove-agent-from-project.yaml +50 -0
  34. package/templates/scaffold/chief-of-staff/plans/rename-project.yaml +62 -0
  35. package/templates/scaffold/chief-of-staff/plans/unarchive-project.yaml +41 -0
  36. package/templates/scaffold/chief-of-staff/playbook/.gitkeep +0 -0
  37. package/templates/scaffold/conventions.md +608 -0
  38. package/templates/scaffold/design/.gitkeep +0 -0
  39. package/templates/scaffold/design/EXPERT.md +68 -0
  40. package/templates/scaffold/dreamer/README.md +32 -0
  41. package/templates/scaffold/dreamer/agent.md +101 -0
  42. package/templates/scaffold/dreamer/logs/.gitkeep +0 -0
  43. package/templates/scaffold/dreamer/pending/.gitkeep +0 -0
  44. package/templates/scaffold/dreamer/plans/nightly-reflection.yaml +113 -0
  45. package/templates/scaffold/dreamer/playbook/.gitkeep +0 -0
  46. package/templates/scaffold/dreamer/state.md +13 -0
  47. package/templates/scaffold/dreamer/subagents/lesson-drafter.md +56 -0
  48. package/templates/scaffold/dreamer/subagents/pattern-detector.md +55 -0
  49. package/templates/scaffold/dreamer/subagents/promotion-arbiter.md +64 -0
  50. package/templates/scaffold/gtm/EXPERT.md +83 -0
  51. package/templates/scaffold/gtm/sdr/.claude/settings.json +3 -0
  52. package/templates/scaffold/gtm/sdr/.mcp.json +21 -0
  53. package/templates/scaffold/gtm/sdr/README.md +46 -0
  54. package/templates/scaffold/gtm/sdr/agent.md +136 -0
  55. package/templates/scaffold/gtm/sdr/plans/cold-outreach.yaml +92 -0
  56. package/templates/scaffold/gtm/sdr/playbook/.gitkeep +0 -0
  57. package/templates/scaffold/gtm/sdr/projects/_demo/asset-references.md +7 -0
  58. package/templates/scaffold/gtm/sdr/projects/_demo/config/default.yaml +69 -0
  59. package/templates/scaffold/gtm/sdr/projects/_demo/log/feedback/.gitkeep +0 -0
  60. package/templates/scaffold/gtm/sdr/projects/_demo/log/runs/.gitkeep +0 -0
  61. package/templates/scaffold/gtm/sdr/projects/_demo/playbook/.gitkeep +0 -0
  62. package/templates/scaffold/gtm/sdr/subagents/critic.md +67 -0
  63. package/templates/scaffold/gtm/sdr/subagents/enricher.md +49 -0
  64. package/templates/scaffold/gtm/sdr/subagents/prospector.md +44 -0
  65. package/templates/scaffold/gtm/sdr/subagents/writer.md +51 -0
  66. package/templates/scaffold/logs/cron/.gitkeep +0 -0
  67. package/templates/scaffold/ops/.gitkeep +0 -0
  68. package/templates/scaffold/ops/EXPERT.md +84 -0
  69. package/templates/scaffold/product/.gitkeep +0 -0
  70. package/templates/scaffold/product/EXPERT.md +87 -0
  71. package/templates/scaffold/projects/_demo/CLAUDE.md +35 -0
  72. package/templates/scaffold/projects/_demo/README.md +16 -0
  73. package/templates/scaffold/projects/_demo/assets/.gitkeep +0 -0
  74. package/templates/scaffold/projects/_demo/config/default.yaml +28 -0
  75. package/templates/scaffold/projects/_demo/guidelines/asset-links.md +15 -0
  76. package/templates/scaffold/projects/_demo/guidelines/brand-book.md +25 -0
  77. package/templates/scaffold/projects/_demo/guidelines/icps/_persona-template.md +44 -0
  78. package/templates/scaffold/projects/_demo/guidelines/messaging.md +20 -0
  79. package/templates/scaffold/projects/_demo/guidelines/voice.md +29 -0
  80. package/templates/scaffold/projects/_demo/state.md +11 -0
  81. package/templates/scaffold/scripts/lib/README.md +13 -0
  82. package/templates/scaffold/scripts/lib/functions.sh +89 -0
  83. package/templates/scaffold/scripts/new-project.sh +125 -0
package/lib/.gitkeep ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@firatcand/roster",
3
+ "version": "0.1.0",
4
+ "description": "A CLI that scaffolds a structured multi-agent workspace on top of AI coding tools (Claude Code, Codex CLI, Gemini)",
5
+ "type": "module",
6
+ "bin": {
7
+ "roster": "bin/roster.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "lib/",
12
+ "skills/",
13
+ "agents/",
14
+ "templates/",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "engines": {
19
+ "node": "^22.18.0 || >=24.0.0"
20
+ },
21
+ "scripts": {
22
+ "build": "tsdown",
23
+ "typecheck": "tsc --noEmit",
24
+ "dev": "tsdown --watch",
25
+ "test": "node --test --experimental-strip-types 'test/**/*.test.ts'",
26
+ "smoke": "bash test/smoke.sh",
27
+ "e2e": "bash test/e2e-sdr.sh",
28
+ "perf": "bash test/perf.sh"
29
+ },
30
+ "keywords": [
31
+ "claude-code",
32
+ "claude",
33
+ "codex",
34
+ "gemini",
35
+ "ai-agent",
36
+ "agentic",
37
+ "skills",
38
+ "subagents",
39
+ "agent-team",
40
+ "operations",
41
+ "gtm",
42
+ "linear",
43
+ "slack"
44
+ ],
45
+ "author": "Firat Can Basarir",
46
+ "license": "MIT",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/firatcand/roster.git"
50
+ },
51
+ "homepage": "https://github.com/firatcand/roster#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/firatcand/roster/issues"
54
+ },
55
+ "dependencies": {
56
+ "@inquirer/prompts": "^8.4.3",
57
+ "chalk": "^5.3.0",
58
+ "fs-extra": "^11.2.0",
59
+ "yaml": "^2.9.0",
60
+ "zod": "^4.4.3"
61
+ },
62
+ "devDependencies": {
63
+ "@types/fs-extra": "^11.0.4",
64
+ "@types/node": "^22.17.2",
65
+ "tsdown": "^0.22.0",
66
+ "typescript": "^6.0.3"
67
+ }
68
+ }
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: chief-of-staff
3
+ description: "Repo maintenance for roster workspaces — create, archive, rename, audit projects, agents, and functions. Wraps shell scripts in scripts/ with mandatory confirmation gates for destructive operations. Triggers when the user asks to scaffold or restructure a roster workspace, or invokes the /chief-of-staff slash command."
4
+ version: "0.1.0"
5
+ trigger_conditions:
6
+ - "User invokes the /chief-of-staff slash command"
7
+ - "User asks to create, archive, rename, or audit a project (e.g., 'archive _demo', 'create project acme with gtm/sdr')"
8
+ - "User asks to add or remove an agent from an existing project"
9
+ - "User asks for a repo or project completeness audit"
10
+ ---
11
+
12
+ # Chief of Staff
13
+
14
+ Structural maintenance for a roster workspace. **Operate on the workspace itself**, not on the business workflows inside it. This skill scaffolds empty structure, archives completed projects, renames things, and audits completeness. Filling content into the scaffolds is a separate concern handled by function-level experts and role-level agents.
15
+
16
+ When in doubt, defer to `conventions.md` in the workspace root for the canonical structure schema, and to the `_template/` directories for the canonical scaffold contents.
17
+
18
+ ## Working directory
19
+
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:
21
+
22
+ > Run chief-of-staff from your roster workspace root.
23
+
24
+ ## How invocation works
25
+
26
+ The user invokes via slash command or natural language. Parse intent into a plan name plus parameters. Examples:
27
+
28
+ - `/chief-of-staff create-project acme with gtm/sdr` → `plan=create-project project=acme agents=[gtm/sdr]`
29
+ - `/chief-of-staff archive-project test-scaffold` → `plan=archive-project project=test-scaffold`
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
+
33
+ When invoked without a plan, list the available plans and ask which to run.
34
+
35
+ ## Plans
36
+
37
+ | Plan | Description | Destructive? |
38
+ |---|---|---|
39
+ | `create-project` | Create a new project, optionally with agent instances | no |
40
+ | `create-agent` | Create a new global agent under a function (interactive dialogue by default — see § "Guided agent creation"; `mode=stub` for headless) | no |
41
+ | `create-function` | Add a new function category to the registry | no |
42
+ | `add-agent-to-project` | Add an agent instance to an existing project | no |
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 |
50
+
51
+ Each plan lives in `chief-of-staff/plans/<plan>.yaml` in the workspace, backed by a script in `scripts/`.
52
+
53
+ ## Common preamble for every plan
54
+
55
+ 1. **Confirm cwd is repo root.** Check for `CLAUDE.md`, `conventions.md`, `gtm/`, `projects/`. If not all present, abort with the message above.
56
+ 2. **Parse the user's request.** Extract plan name and parameters. If ambiguous, ask before proceeding.
57
+ 3. **Show the plan.** For destructive plans, summarize exactly what will happen (paths created, moved, modified) and ask `proceed?`.
58
+ 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, moved). Note anything skipped or any warnings.
60
+ 6. **Never auto-commit to git.** Leave commits for the user.
61
+
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
+ ## Guided agent creation
69
+
70
+ The `create-agent` plan runs in one of two modes (see `chief-of-staff/plans/create-agent.yaml`):
71
+
72
+ - **stub** — byte-identical to `bash scripts/new-agent.sh`. Drops placeholder files (`<one paragraph...>`, plan stubs, empty `## Tools and bindings`, etc.) and exits. Used in CI, headless contexts, and as the legacy escape hatch.
73
+ - **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
+
75
+ Mode selection priority (first match wins): `${inputs.mode}` → `AGENT_TEAM_NO_CONFIRM=1` (→ `stub`) → TTY detection (TTY → `guided`, no TTY → `stub`).
76
+
77
+ ### Anti-fabrication invariant
78
+
79
+ > 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
+
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` / `_template/`. Never fill in plausible-looking defaults to make the output feel complete — gaps stay gaps, surfaced explicitly as follow-up questions.
82
+
83
+ ### EXPERT.md auto-load
84
+
85
+ At the start of the dialogue, the skill checks `<function>/EXPERT.md` for the function the agent is being created under.
86
+
87
+ - **Present:** read it for shape reference. Use it to seed function-typical suggestions in Phase 2 (e.g., a `gtm/` agent typically reads `messaging.md` and ICPs; a `design/` agent typically reads `brand-book.md`). These suggestions are still subject to the anti-fabrication invariant — they become Phase 3 questions, not silent fills.
88
+ - **Missing:** the dialogue proceeds without function-shaped suggestions. The skill discloses the gap **once** at the start of Phase 3:
89
+
90
+ > No `<function>/EXPERT.md` found — proceeding without function-level shape suggestions. You may still register an expert later via `chief-of-staff create-function`.
91
+
92
+ ### Phase 1 — Prose intake
93
+
94
+ Open with a single open-ended prompt:
95
+
96
+ > Describe what this agent does in 1–3 sentences. What does one run produce, on what input, for whom?
97
+
98
+ Accept the answer as-is — no structure required. Capture it verbatim; it seeds the Phase 2 classification.
99
+
100
+ ### Phase 2 — Classify fields as boilerplate / grounded / uncertain
101
+
102
+ Partition every required `agent.md` field into one of three buckets:
103
+
104
+ - **boilerplate** — filled silently from `conventions.md` / `_template/`. 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
+ - **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, project-specific failure modes, plan names.
107
+
108
+ 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
+
110
+ ### Phase 3 — Targeted follow-up Q&A
111
+
112
+ For each item in the uncertain queue, ask one question. Constraints:
113
+
114
+ - **One fact per question.** Don't bundle ("what subagents does this need, and what tools, and what's its failure mode?").
115
+ - **Surface the gap explicitly.** Tell the user *why* you're asking. Example: "Your prose mentioned reviewing CVs but didn't name a model. Which LLM — Claude, GPT, something else?"
116
+ - **Batch by topic when natural.** Subagent-related questions can come in a short cluster; don't context-switch every turn.
117
+ - **Track answered facts.** Never re-ask something the user already said in prose or a previous follow-up. If the user contradicts a prior answer, ask which to keep.
118
+ - **Push back on scope creep.** If the user starts describing a second agent's responsibilities mid-dialogue, redirect: "That sounds like a separate agent. Want to finish this one first and create that one after?"
119
+ - **No invention shortcuts.** When tempted to skip a follow-up by guessing a sensible default, stop and ask instead (anti-fabrication invariant).
120
+
121
+ Continue until the uncertain bucket is empty.
122
+
123
+ ### Phase 4 — Consolidated preview
124
+
125
+ Render the full draft tree to the user. Show:
126
+
127
+ - Every file path that will be written, with a one-line description.
128
+ - The full `agent.md` content (purpose, inputs, steps, subagents, tools, outputs, approval, lessons, failure modes).
129
+ - 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 (empty `.gitkeep` + a stub for the first plan if one was named during Phase 3).
131
+
132
+ Offer three controls:
133
+
134
+ - **`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`, `steps`, `subagents`, `tools`, `outputs`, `approval`, `failure-modes`, `plans`, `slash-command`. 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
+ - **`cancel`** → abort with no writes. Print: `Cancelled. No files written.`
137
+
138
+ Loop on `revise` until the user types `y` or `cancel`. There is no implicit "looks good enough" — explicit acceptance is required.
139
+
140
+ ### Phase 5 — Atomic write
141
+
142
+ See P4-T04 for the atomic-write transaction (stage → invariant check → preview → write → rollback list). The pre-write check enforces the contracts and invariants defined in the next section. Summary: stage all files in a temp tree, validate against `conventions.md` plus the cross-file invariants below, then move into place in a single transaction. On any validation failure, the temp tree is discarded and no partial state is written to the workspace.
143
+
144
+ ## Generated file contracts
145
+
146
+ Every file the guided plan writes has a per-file content contract. Stub mode produces a strict subset (placeholders only); guided mode must populate everything in the "guided" column or the write aborts.
147
+
148
+ | File | Guided-mode contract | Stub-mode contract |
149
+ | --- | --- | --- |
150
+ | `agent.md` | See per-section disposition below. Populated and grounded fields filled from prose + Phase 3 answers; boilerplate fields filled from `_template/` 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. |
151
+ | `plans/<plan>.yaml` | Created only if the user named at least one plan during Phase 3. Step `id:` fields 1:1 with `agent.md ## Steps` — they cannot drift. Inputs / outputs schemas come from the user's plan description. | `plans/.gitkeep` only. No starter plan file. |
152
+ | `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` only. No per-name files. |
153
+ | `.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 from `_template/` with `<agent>` and `<function>` substituted. | `description: <function> agent — TODO: fill in description`. Canonical body otherwise unchanged. |
154
+ | `README.md`, `.mcp.json`, `.claude/settings.json`, `projects/_template/**`, every `.gitkeep` | Identical to stub mode — byte-for-byte. These files do not vary by mode. | (canonical) |
155
+
156
+ ### `agent.md` per-section disposition
157
+
158
+ For each section of the agent.md template (the structure emitted by `scripts/new-agent.sh`):
159
+
160
+ | Section | Disposition |
161
+ | --- | --- |
162
+ | `## Purpose` | **grounded** — drafted from the Phase 1 prose. |
163
+ | `## 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, instance config, project CLAUDE.md, project guidelines, playbooks, recent runs). |
165
+ | `## Steps` | **grounded** — every step comes from prose / Phase 3. Must have matching ids in `plans/<plan>.yaml`. |
166
+ | `## 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 listed gets a bindings block (invariant 3). |
168
+ | `## Outputs` | **boilerplate + grounded** — canonical run-file path is boilerplate; the artifact description is grounded from prose. |
169
+ | `## Approval` | **boilerplate** — `approval_channel: auto` line with the standard Slack / HITL routing paragraph. |
170
+ | `## Lessons protocol` | **boilerplate** — canonical paragraph, identical in every agent. |
171
+ | `## Failure modes` | **boilerplate + uncertain** — standard failures (cwd wrong, slug invalid, script fails) are boilerplate; project-specific failures come from Phase 3. |
172
+
173
+ ### Cross-file invariants
174
+
175
+ Five 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
+
177
+ 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. **Step ids match between agent.md and the starter plan.** Every step in `agent.md ## Steps` appears in the starter `plans/<plan>.yaml` with a matching `id:` field. Order may differ; presence and ids may not.
179
+ 3. **Every named tool has a bindings block.** Every tool listed in `agent.md ## Tools` has a corresponding entry in the `## Tools and bindings` block of `agent.md` with a non-`TODO` `required` flag and a non-empty `description`.
180
+ 4. **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.
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:`.
182
+
183
+ On invariant failure, the skill prints:
184
+
185
+ > Invariant N failed: <specific failure>. Revise the affected section, or `cancel` to abort without writing.
186
+
187
+ Then re-enters Phase 3 for the section that owns the tripped invariant. The atomic-write transaction never proceeds with a tripped invariant.
188
+
189
+ ## Outputs
190
+
191
+ - **Mutation plans:** Summary printed to chat (paths created, moved, 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
+ - **Audit plans:** A report file at `chief-of-staff/logs/<YYYY-MM>/audit-...-<YYYY-MM-DD-HHMM>.md`, plus a condensed stdout summary.
193
+
194
+ Per-plan output schemas are declared in each plan's `outputs:` block in its YAML.
195
+
196
+ ## Lessons protocol
197
+
198
+ If you observe a recurring pattern during operations (e.g., users forgetting to run `create-agent` before `add-agent-to-project`), 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
+
200
+ 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
+
202
+ ## Failure modes
203
+
204
+ - **Cwd not workspace root** → abort with clear message
205
+ - **Invalid slug or function name** → abort with an example of valid format
206
+ - **Collision (target already exists)** → abort, tell the user the existing path
207
+ - **Missing dependency** (e.g., agent doesn't exist for `add-agent-to-project`) → abort, suggest the prerequisite plan
208
+ - **Script fails** → surface the script's stderr; do not attempt to recover by doing the work directly
209
+ - **YAML/JSON parse error in audit** → report as failure with the line number from the audit script
210
+ - **Confirmation gate denied** → abort cleanly, no changes
211
+ - **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.
212
+
213
+ ## What this skill does NOT do
214
+
215
+ - Run business workflows (SDR outreach, design generation, content authoring). Those are separate role-level skills.
216
+ - Edit guidelines, ICPs, voice, or any project substrate content. That's expert-level work.
217
+ - Make git commits. Always leave commits for the user.
218
+ - Touch files outside the workspace.
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: dreamer
3
+ description: "Off-hours reflection agent. Reads recent runs and feedback across all agents and projects, detects recurring patterns, drafts lesson candidates, routes through HITL approval, and writes approved lessons to the right playbook scope. The only agent that writes to playbook files. Triggers when the user invokes /dreamer or asks to consolidate lessons from past work."
4
+ version: "0.1.0"
5
+ trigger_conditions:
6
+ - "User invokes the /dreamer slash command"
7
+ - "User asks to run nightly reflection, consolidate lessons, or review pattern candidates (e.g., 'reflect on last week's runs', 'draft lessons from recent feedback')"
8
+ - "Cron or /schedule fires a nightly-reflection plan"
9
+ - "User asks why an agent is or isn't learning, or how a lesson got promoted"
10
+ ---
11
+
12
+ # Dreamer
13
+
14
+ ## Purpose
15
+
16
+ Reinforcement and consolidation. Reads recent runs, feedback, and post-hoc analytics across all agents and all projects. Detects patterns. Drafts lesson candidates. Routes through HITL approval. On approval, writes lessons to the right scope (project-scoped or global).
17
+
18
+ This is the only agent allowed to write to `playbook/` files (apart from the user writing by hand with `source: human`).
19
+
20
+ ## Why "dreaming"
21
+
22
+ Off-hours reflection. Not in the loop with live runs. Pulls signal from artifacts after work is done. Lets evidence accumulate. Mirrors how humans consolidate memory during sleep.
23
+
24
+ ## Inputs
25
+
26
+ The orchestrator (slash command, cron, or natural-language invocation) expects:
27
+
28
+ - `plan`: name of a plan in `dreamer/plans/` (currently only `nightly-reflection`)
29
+ - Per-plan inputs (see the plan's `inputs:` block — `mode`, `scope`, `since`)
30
+
31
+ Read at runtime:
32
+
33
+ - `agent.md` (this file)
34
+ - `dreamer/plans/<plan>.yaml` — the workflow recipe
35
+ - `dreamer/state.md` — last processed cutoff and run summary
36
+ - `dreamer/pending/` — queued candidates awaiting Slack approval
37
+ - All `<function>/<agent>/projects/<project>/log/runs/` and `log/feedback/` for material since the cutoff
38
+ - Existing playbook lessons for evidence comparison
39
+
40
+ ## Plans
41
+
42
+ This agent runs via plans in `dreamer/plans/`. Available plans:
43
+
44
+ - `nightly-reflection` — Cross-cutting reinforcement: scan runs/feedback since the last cutoff, detect patterns, draft and promote lessons via Slack #admin HITL.
45
+
46
+ Invoke via slash command:
47
+
48
+ ```
49
+ /dreamer run nightly-reflection
50
+ /dreamer run nightly-reflection since 2026-04-15
51
+ ```
52
+
53
+ Typically scheduled nightly via cron or `/schedule`. When invoked without a plan, lists available plans and asks which to run.
54
+
55
+ ## Subagents
56
+
57
+ - `pattern-detector.md` — finds patterns across runs+feedback
58
+ - `lesson-drafter.md` — drafts a single lesson in schema format
59
+ - `promotion-arbiter.md` — decides project vs global scope for validated lessons
60
+
61
+ ## Tools and bindings
62
+
63
+ - File reads across the entire repo (the one agent that crawls broadly) — no per-project bindings
64
+ - `Slack` MCP — for HITL posting (from universal `.mcp.json`); HITL channel resolved via `SLACK_HITL_CHANNEL_ADMIN` env var
65
+ - No external APIs needed beyond Slack
66
+
67
+ ## Outputs
68
+
69
+ Run file at `dreamer/logs/<YYYY-MM>/<YYYY-MM-DD-HHMM>.md` containing:
70
+
71
+ - Material processed (counts by project and agent)
72
+ - Patterns detected
73
+ - Lesson candidates drafted (Slack thread links)
74
+ - Promotion candidates
75
+ - Approvals applied
76
+ - Conflicts surfaced
77
+
78
+ State file at `dreamer/state.md` tracking last successful run timestamp + summary. Per-plan output schemas live in the plan's `outputs:` block.
79
+
80
+ ## Approval
81
+
82
+ `approval_channel: slack` always. The dreamer typically runs nightly via cron — there's no interactive caller.
83
+
84
+ TTL: 7 days. Unapproved candidates roll forward in `dreamer/pending/`. After 7 days, marked stale and require re-evaluation.
85
+
86
+ ## Pattern detection signals
87
+
88
+ Learns from:
89
+
90
+ 1. **HITL feedback** in `feedback/` files
91
+ 2. **Post-hoc analytics** logged into runs (reply rates, post impressions, conversion outcomes)
92
+ 3. **Implicit signals** — repeated patterns in successful vs unsuccessful runs
93
+
94
+ Threshold mechanism prevents whipsaw: a candidate requires N consistent observations (default 20 with 70% consistency) before becoming `validated`.
95
+
96
+ ## Respecting human-written lessons
97
+
98
+ If a lesson has `source: human`, the dreamer does NOT modify or supersede it without explicit HITL approval. The dreamer can:
99
+ - Extend it (write a related lesson with `extends: <id>`)
100
+ - Flag a contradiction (write a candidate with `contradicts: <id>` and let HITL decide)
101
+ - Surface evidence that supports/refutes it in its run output
102
+
103
+ ## Lessons protocol
104
+
105
+ The dreamer writes lessons FOR other agents. It does not write lessons about itself — meta-observations about the dreamer's own patterns belong in `dreamer/logs/` run output, not in `dreamer/playbook/`. The user may hand-write a `dreamer/playbook/L-...md` lesson with `source: human` if needed.
106
+
107
+ ## Failure modes
108
+
109
+ - **No new material**: log no-op run, exit cleanly
110
+ - **Slack unavailable**: queue candidates locally in `dreamer/pending/`, retry next run
111
+ - **Conflicting lessons across projects**: do NOT auto-merge. Surface conflict; HITL decides.
112
+ - **Threshold not met**: keep candidate in `observing` status, accumulate evidence next pass
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: roster-orchestrator
3
+ description: "Bootstraps roster workspaces. On chat session start, surfaces pending HITL items as a single banner. On a scheduled fire, verifies the schedule is registered, dispatches the named agent via the host tool's native subagent primitive, writes a run log + state.md entry, and exits. Reads roster/<function>/schedules.yaml and roster/<function>/pending/. Subscription-billed primitives only — never invokes claude -p, claude --prompt, claude api, or the Anthropic SDK."
4
+ version: "0.1.0"
5
+ trigger_conditions:
6
+ - "Session start in a roster workspace (CONTEXT.md / CLAUDE.md / AGENTS.md present at cwd)"
7
+ - "A scheduled fire prompt names a roster agent (e.g., 'Run sdr cold-outreach for _demo')"
8
+ - "User invokes /roster-orchestrator"
9
+ ---
10
+
11
+ # roster-orchestrator
12
+
13
+ The bootstrap entry point for every fresh CLI session in a roster workspace. Two modes:
14
+
15
+ 1. **Chat-session bootstrap** — surface a single banner if `roster/*/pending/` has items.
16
+ 2. **Scheduled fire** — verify the fire matches a registered schedule, dispatch the named agent, log the run, exit.
17
+
18
+ The skill is **stateless**. It re-reads disk on every invocation so `/clear` and fresh fires both work identically.
19
+
20
+ ## Working directory
21
+
22
+ Operate from the workspace root only — the directory containing `CONTEXT.md` (or the `CLAUDE.md` / `AGENTS.md` symlink that points to it) plus a `roster/` directory. If invoked elsewhere, abort with:
23
+
24
+ > Run roster-orchestrator from your roster workspace root (must contain CONTEXT.md and roster/).
25
+
26
+ ## Mode detection
27
+
28
+ Inspect the initial prompt:
29
+
30
+ - If it matches a scheduled-fire shape (`Run <agent> <plan> for <project>`, `Use the <agent> skill to <plan> for <project>`, etc.) → **scheduled-fire mode**.
31
+ - Otherwise → **chat-session-bootstrap mode**.
32
+
33
+ When ambiguous, default to chat-session-bootstrap (it is the safe no-op when no fire is happening).
34
+
35
+ ## Mode 1 — Chat-session bootstrap
36
+
37
+ 1. Walk `roster/*/pending/` across all functions (`gtm`, `product`, `design`, `ops`, `marketing`, …).
38
+ 2. Count files matching `*.md` (one HITL item per file).
39
+ 3. If count == 0 → print nothing, exit silently.
40
+ 4. If count > 0 → print one banner line and stop:
41
+ ```
42
+ ⚠ N pending HITL items — run `roster review`
43
+ ```
44
+ (Single-line surface. The full review UI lives behind the `roster review` CLI.)
45
+
46
+ No other side effects. Do not read item bodies. Do not modify any file.
47
+
48
+ ## Mode 2 — Scheduled fire
49
+
50
+ 1. Parse the fire prompt for `<agent>`, `<plan>`, `<project>`.
51
+ - Preferred shape: `<function>/<agent>` (e.g., `gtm/sdr`). Use this whenever the prompt provides it.
52
+ - Bare-agent shape (e.g., `sdr`): resolve by scanning `<function>/<agent>/` for exactly one matching directory. If zero or more than one match, abort with the parsed fields and the candidate functions.
53
+ - Refuse if `<agent>`, `<plan>`, or `<project>` is missing — list which one.
54
+ 2. Load `roster/<function>/schedules.yaml` using the resolved function from step 1.
55
+ 3. Verify an entry exists in `schedules.yaml` with matching `agent` + `plan` + `project`. If not, abort with:
56
+ > Schedule not registered: <function>/<agent>/<plan> for <project>. Use `roster schedule list` to see registered schedules.
57
+ 4. Dispatch the named agent via the host tool's subagent primitive (see "Subagent dispatch" below). Block until the subagent returns. The subagent runs in isolated context; nothing leaks back here.
58
+ 5. Append a single line to `roster/<function>/state.md`. Exact format (one line, three fields, pipe-separated with surrounding single spaces):
59
+ ```
60
+ <utc-iso-8601> | <function>/<agent>/<plan>/<project> | <status>
61
+ ```
62
+ - `<utc-iso-8601>`: UTC, second precision, `Z` suffix. Example: `2026-05-16T14:09:00Z`.
63
+ - `<status>`: exactly one of `success` or `failed`. No other values.
64
+ 6. The subagent itself is responsible for the full run log at `<function>/<agent>/projects/<project>/log/runs/<ts>.md`. Do not write that file from here.
65
+ 7. Exit cleanly. Do not start a new turn.
66
+
67
+ ## Subagent dispatch
68
+
69
+ The skill body is tool-agnostic. Use the dispatch idiom that matches the host CLI:
70
+
71
+ ### On Claude Code
72
+
73
+ Use the `Task` tool with `run_in_background: false`:
74
+
75
+ ```
76
+ Task(
77
+ subagent_type="<agent>",
78
+ prompt="Run plan <plan> for project <project>",
79
+ run_in_background=false,
80
+ )
81
+ ```
82
+
83
+ The subagent runs in isolated context. The return value is a short status string (~30 tokens). No other tools should be invoked in this turn.
84
+
85
+ ### On Codex CLI
86
+
87
+ Invoke the subagent via natural language. Codex resolves the agent name against `~/.codex/agents/<agent>.toml`:
88
+
89
+ > Use the `<agent>` subagent to run plan `<plan>` for project `<project>`.
90
+
91
+ Wait for the subagent to return its status, then proceed to the state.md write.
92
+
93
+ ## Subscription-billing guarantee
94
+
95
+ This skill — and every subagent it dispatches — must run on the user's interactive Claude Pro/Max or ChatGPT Plus/Pro subscription. **Banned primitives** (any occurrence is a release blocker, enforced by `roster doctor` and CI audit):
96
+
97
+ - `claude -p` <!-- roster-audit-ok: claude-p-flag -->
98
+ - `claude --prompt` <!-- roster-audit-ok: claude-prompt-flag -->
99
+ - `claude api` <!-- roster-audit-ok: claude-api-cmd -->
100
+ - `@anthropic-ai/sdk` <!-- roster-audit-ok: anthropic-sdk-import -->
101
+ - `from anthropic` <!-- roster-audit-ok: python-anthropic-import -->
102
+ - Any wrapper that re-routes calls through the Agent SDK billing pool
103
+
104
+ **Scope of the guarantee.** The static audit blocks the above literals in roster's *shipped source* (skills/, src/) at build/install time. It is a source guard, not a runtime sandbox — nothing prevents a host LLM from inventing a banned invocation while following these instructions. Runtime compliance depends on the LLM honoring this section.
105
+
106
+ If you encounter a workflow that seems to require one of the above, stop and surface it as a HITL item. Do not attempt to bypass.
107
+
108
+ ## What this skill does NOT do
109
+
110
+ - Execute business logic (SDR outreach, content drafts, design generation). That's the dispatched subagent's job.
111
+ - Read or modify HITL item bodies. That's `roster review`.
112
+ - Write the full run log. That's the dispatched subagent.
113
+ - Touch git. Roster never auto-commits.
114
+ - Invoke any model billing path other than the host tool's native subscription.
115
+
116
+ ## Failure modes
117
+
118
+ - **Cwd not a roster workspace** → abort with the message above.
119
+ - **Fire prompt missing agent/plan/project** → abort, list the parsed fields.
120
+ - **Schedule not registered** → abort with the `roster schedule list` pointer.
121
+ - **Subagent dispatch fails** → write `status=failed` to state.md, do not retry. Failure-class HITL items are created by the next session-start (ROS-42 / failure observability).
122
+ - **`roster/` directory missing** → first run on a fresh init; treat as zero pending items, exit cleanly.