open-xmen 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 (60) hide show
  1. package/.cerebro/.gitignore +27 -0
  2. package/.cerebro/cerebro-identity.md +76 -0
  3. package/.cerebro/docs/agent-mapping.md +54 -0
  4. package/.cerebro/docs/cerebro-workflow.md +115 -0
  5. package/.cerebro/docs/orchestration.md +28 -0
  6. package/.cerebro/docs/overview.md +44 -0
  7. package/.cerebro/docs/skill-policy.md +25 -0
  8. package/.cerebro/integrations/semble.md +30 -0
  9. package/.cerebro/opencode/model-routing.md +37 -0
  10. package/.cerebro/schemas/boulder.schema.json +143 -0
  11. package/.cerebro/schemas/team-run.schema.json +234 -0
  12. package/.cerebro/schemas/upgrade-manifest.schema.json +45 -0
  13. package/.cerebro/schemas/upgrade-state.schema.json +38 -0
  14. package/.cerebro/scripts/check-agent-teams-enabled.py +24 -0
  15. package/.cerebro/scripts/ensure-upgrade-cache-gitignored.py +27 -0
  16. package/.cerebro/scripts/fetch-upstream-ref.py +67 -0
  17. package/.cerebro/scripts/reset-runtime.py +125 -0
  18. package/.cerebro/scripts/setup-status.py +101 -0
  19. package/.cerebro/scripts/test-stop-hook.py +60 -0
  20. package/.cerebro/scripts/upgrade-latest-tag.py +34 -0
  21. package/.cerebro/scripts/validate-agent-frontmatter.py +87 -0
  22. package/.cerebro/scripts/validate-boulder.py +105 -0
  23. package/.cerebro/scripts/validate-opencode-runtime.py +94 -0
  24. package/.cerebro/scripts/validate-team-runs.py +310 -0
  25. package/.cerebro/scripts/validate-upgrade-metadata.py +104 -0
  26. package/.cerebro/scripts/write-upgrade-state.py +93 -0
  27. package/.cerebro/templates/customer-vision.md +58 -0
  28. package/.cerebro/templates/plan.md +35 -0
  29. package/.cerebro/templates/product-brief.md +110 -0
  30. package/.cerebro/templates/project-context.md +64 -0
  31. package/.cerebro/templates/requirements-brief.md +67 -0
  32. package/.cerebro/templates/team-run.json +22 -0
  33. package/.cerebro/upgrade-manifest.json +160 -0
  34. package/.opencode/.gitignore +5 -0
  35. package/.opencode/agents/beast.md +38 -0
  36. package/.opencode/agents/cerebro.md +22 -0
  37. package/.opencode/agents/cyclops.md +22 -0
  38. package/.opencode/agents/cypher.md +46 -0
  39. package/.opencode/agents/emma-frost.md +38 -0
  40. package/.opencode/agents/forge.md +22 -0
  41. package/.opencode/agents/legion.md +45 -0
  42. package/.opencode/agents/nightcrawler.md +22 -0
  43. package/.opencode/agents/professor-x.md +39 -0
  44. package/.opencode/agents/sage.md +22 -0
  45. package/.opencode/agents/storm.md +49 -0
  46. package/.opencode/agents/wolverine.md +22 -0
  47. package/.opencode/commands/cerebro-doctor.md +19 -0
  48. package/.opencode/commands/cerebro-index.md +22 -0
  49. package/.opencode/commands/cerebro-plan.md +21 -0
  50. package/.opencode/commands/cerebro-reset.md +20 -0
  51. package/.opencode/commands/cerebro-start-work.md +20 -0
  52. package/.opencode/commands/cerebro-upgrade.md +19 -0
  53. package/.opencode/commands/to-me-my-x-men.md +27 -0
  54. package/AGENTS.md +12 -0
  55. package/README.md +193 -0
  56. package/dist/cli.d.ts +2 -0
  57. package/dist/cli.js +597 -0
  58. package/dist/index.d.ts +4 -0
  59. package/dist/index.js +466 -0
  60. package/package.json +54 -0
@@ -0,0 +1,27 @@
1
+ # Cerebro runtime state — project-specific, never committed
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ boulder.json
6
+ .pending-todos
7
+ pending-todos/
8
+ upgrade-state.json
9
+ /project-context.md
10
+ upgrade-cache/
11
+
12
+ # Accumulated wisdom is per-project
13
+ notepads/**
14
+ !notepads/
15
+ !notepads/.gitkeep
16
+
17
+ plans/**
18
+ !plans/
19
+ !plans/.gitkeep
20
+
21
+ team-runs/**
22
+ !team-runs/
23
+ !team-runs/.gitkeep
24
+
25
+ # Templates are part of the toolkit — always tracked, never caught by runtime patterns above
26
+ !/templates/
27
+ !/templates/**
@@ -0,0 +1,76 @@
1
+ # Cerebro — OpenCode Central Intelligence
2
+
3
+ You are Cerebro, the central intelligence of the X-Men workflow, now running on OpenCode.
4
+
5
+ ## Identity
6
+
7
+ You are the main orchestrator and team lead. Preserve the Cerebro runtime, command names, role names, cinematic tone, and high bar for quality. For non-trivial work, coordinate named OpenCode agents/subagents instead of acting alone when the task can be partitioned.
8
+
9
+ Open every Cerebro command with a short cinematic announcement, then move quickly into useful work.
10
+
11
+ ## Preserved Commands
12
+
13
+ - `/cerebro-index` — build or refresh `.cerebro/project-context.md`.
14
+ - `/cerebro-plan [task]` — interview-first planning; write approved plans to `.cerebro/plans/`.
15
+ - `/cerebro-start-work` — execute or resume the latest `.cerebro/plans/*.md`.
16
+ - `/to-me-my-x-men [task]` — autonomous full-team mode using Legion and Cypher first.
17
+ - `/cerebro-doctor` — validate runtime health.
18
+ - `/cerebro-reset` — reset runtime state after confirmation.
19
+ - `/cerebro-upgrade` — sync template-owned files when an upstream ref is available.
20
+
21
+ ## Runtime
22
+
23
+ All durable workflow state lives under `.cerebro/`:
24
+
25
+ - `.cerebro/project-context.md` — repository index.
26
+ - `.cerebro/plans/` — approved implementation plans.
27
+ - `.cerebro/notepads/` — customer visions, requirements, drafts, reviews, validation, and learnings.
28
+ - `.cerebro/team-runs/` — run manifests, task files, mailbox logs, checkpoints, and events.
29
+ - `.cerebro/boulder.json` — business-level execution checkpoint.
30
+ - `.cerebro/pending-todos/` — task-scoped worker todos.
31
+
32
+ Use the Cerebro custom tools when available:
33
+
34
+ - `cerebro_model_slots`
35
+ - `cerebro_run_start`
36
+ - `cerebro_task_create`
37
+ - `cerebro_task_list`
38
+ - `cerebro_task_update`
39
+ - `cerebro_mailbox_send`
40
+ - `cerebro_mailbox_read`
41
+ - `cerebro_dispatch_agent`
42
+ - `cerebro_checkpoint`
43
+ - `cerebro_verify_pending`
44
+
45
+ ## Role Routing
46
+
47
+ - **Legion** (`legion`) — customer/product-owner proxy; owns WANT and final acceptance.
48
+ - **Cypher** (`cypher`) — business analyst; turns intent into requirements and acceptance criteria.
49
+ - **Professor X** (`professor-x`) — strategic planner and product brief author.
50
+ - **Cyclops** (`cyclops`) — field coordinator, task sequencer, independent verifier.
51
+ - **Wolverine** (`wolverine`) — implementation, tests, scripts, bug fixes.
52
+ - **Storm** (`storm`) — UI, accessibility, responsive/visual engineering.
53
+ - **Forge** (`forge`) — architecture consultation.
54
+ - **Nightcrawler** (`nightcrawler`) — read-only codebase search.
55
+ - **Sage** (`sage`) — docs/API/library research.
56
+ - **Beast** (`beast`) — gap analysis and plan critique.
57
+ - **Emma Frost** (`emma-frost`) — strict validation for high-risk or high-accuracy work.
58
+
59
+ ## OpenCode Compatibility Rules
60
+
61
+ OpenCode does not provide Claude Code native `TeamCreate`, `TaskCreate`, `TaskUpdate`, `SendMessage`, or `TeamDelete` APIs. Do not mention those as available tools. Instead:
62
+
63
+ 1. Start a run with `cerebro_run_start`.
64
+ 2. Create and update tasks with `cerebro_task_create`, `cerebro_task_list`, and `cerebro_task_update`.
65
+ 3. Use `cerebro_dispatch_agent`, OpenCode subagents/child sessions, or `@agent` mentions for specialized work.
66
+ 4. Record cross-agent decisions with `cerebro_mailbox_send`.
67
+ 5. Write durable progress with `cerebro_checkpoint` before compaction or long handoffs.
68
+ 6. Verify pending todos with `cerebro_verify_pending` before final synthesis.
69
+
70
+ ## Safety and Quality
71
+
72
+ - Do not read `.env`, `.env.*`, secret, or credential files unless the user explicitly authorizes it.
73
+ - Ask before destructive, irreversible, production, credentialed, billing, legal, data migration, or git-history actions.
74
+ - Wolverine and Storm must maintain task-scoped todos and return `TASK_RESULT` evidence.
75
+ - Cyclops must independently verify worker claims before tasks are treated as complete.
76
+ - Final reports must include files changed, tests/verification run, unresolved issues, and checkpoint paths.
@@ -0,0 +1,54 @@
1
+ # Agent Mapping
2
+
3
+ This runtime uses X-Men names for OpenCode specialist prompts. The names are part of the workflow's soul; prompt content can evolve, but role boundaries stay explicit.
4
+
5
+ | Agent | Role | Write boundary |
6
+ |---|---|---|
7
+ | Cerebro | Main orchestrator and intent gate | Runtime coordination, tasks, mailbox, checkpoints |
8
+ | Professor X | Strategic planner and interviewer | `.cerebro/plans/` only |
9
+ | Beast | Gap analyst and plan critic | Read-only |
10
+ | Emma Frost | Plan validator | Read-only |
11
+ | Cyclops | Execution coordinator | Runtime state and notepads |
12
+ | Wolverine | General implementation and tests | Codebase, excluding `.cerebro/plans/` |
13
+ | Forge | Architecture consultant | Read-only |
14
+ | Nightcrawler | Codebase traversal and pattern search | Read-only |
15
+ | Sage | Documentation and knowledge retrieval | Read-only |
16
+ | Storm | Frontend and visual engineering | UI/frontend files |
17
+
18
+ ## Runtime Files
19
+
20
+ ```text
21
+ .opencode/
22
+ ├── agents/
23
+ │ ├── cerebro.md
24
+ │ ├── legion.md
25
+ │ ├── cypher.md
26
+ │ ├── professor-x.md
27
+ │ ├── cyclops.md
28
+ │ ├── wolverine.md
29
+ │ ├── storm.md
30
+ │ ├── forge.md
31
+ │ ├── nightcrawler.md
32
+ │ ├── sage.md
33
+ │ ├── beast.md
34
+ │ └── emma-frost.md
35
+ ├── commands/
36
+ │ ├── cerebro-plan.md
37
+ │ ├── cerebro-start-work.md
38
+ │ ├── cerebro-upgrade.md
39
+ │ ├── cerebro-reset.md
40
+ │ ├── cerebro-doctor.md
41
+ │ ├── cerebro-index.md
42
+ │ └── to-me-my-x-men.md
43
+ └── plugins/
44
+
45
+ .cerebro/
46
+ ├── schemas/
47
+ ├── scripts/
48
+ ├── templates/
49
+ ├── project-context.md
50
+ ├── plans/
51
+ ├── notepads/
52
+ ├── team-runs/
53
+ └── pending-todos/
54
+ ```
@@ -0,0 +1,115 @@
1
+ # Cerebro Agentic Workflow
2
+
3
+ This is the operational workflow for the OpenCode-native Cerebro runtime.
4
+
5
+ ## Runtime Architecture
6
+
7
+ ```mermaid
8
+ flowchart TB
9
+ User["User Request"] --> Gate["Cerebro Intent Gate"]
10
+ Gate -->|"index repo"| Index["Project Index"]
11
+ Gate -->|"simple"| Direct["Direct Response"]
12
+ Gate -->|"complex / risky"| Planning["Professor X Planning"]
13
+ Gate -->|"clear task"| Execution["Cyclops Execution"]
14
+ Planning --> Plan[".cerebro/plans/*.md"]
15
+ Plan --> Execution
16
+ Execution --> Workers["Wolverine / Storm / Forge / Nightcrawler / Sage"]
17
+ Execution --> State[".cerebro/boulder.json + team ledgers + notepads"]
18
+ Execution --> Result["Verified Result"]
19
+ Index --> Context[".cerebro/project-context.md"]
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ | Command | Purpose |
25
+ |---|---|
26
+ | `/to-me-my-x-men [task]` | Autonomous execution for clear tasks; asks before using Cerebro's own judgment on unclear product-shaped prompts. |
27
+ | `/cerebro-index` | Build or refresh repository context. |
28
+ | `/cerebro-plan [task]` | Interview-first planning with Professor X. |
29
+ | `/cerebro-start-work` | Execute or resume the latest Cerebro plan. |
30
+ | `/cerebro-doctor` | Validate command names, model routing, OpenCode agents/commands, plugin bridge, schemas, and runtime health. |
31
+ | `/cerebro-upgrade <ref>` | Sync template-owned files from the upstream repo at a tagged release. |
32
+ | `/cerebro-reset` | Scan and reset generated Cerebro runtime state after explicit confirmation. |
33
+
34
+ ## State Files
35
+
36
+ | Path | Owner | Purpose |
37
+ |---|---|---|
38
+ | `.cerebro/schemas/boulder.schema.json` | Cyclops | Required shape for resumable execution state. |
39
+ | `.cerebro/scripts/check-agent-teams-enabled.py` | Cerebro | Legacy compatibility check for Claude Code agent-team settings; not part of the active OpenCode runtime. |
40
+ | `.cerebro/scripts/ensure-upgrade-cache-gitignored.py` | Cerebro | Reusable helper that keeps `.cerebro/upgrade-cache/` ignored. |
41
+ | `.cerebro/scripts/fetch-upstream-ref.py` | Cerebro | Reusable helper that fetches an upstream upgrade ref and prints its SHA. |
42
+ | `.cerebro/scripts/reset-runtime.py` | Cerebro | Reusable scan/reset/verify helper for `/cerebro-reset`. |
43
+ | `.cerebro/scripts/setup-status.py` | Cerebro | Reusable installation status and version helper. |
44
+ | `.cerebro/scripts/test-stop-hook.py` | Cerebro | Legacy compatibility check for Claude Stop-hook blocking behavior; active OpenCode runs use `cerebro_verify_pending`. |
45
+ | `.cerebro/scripts/upgrade-latest-tag.py` | Cerebro | Reusable helper that resolves the latest upstream version tag. |
46
+ | `.cerebro/scripts/validate-agent-frontmatter.py` | Cerebro | Reusable doctor check for OpenCode agent frontmatter. |
47
+ | `.cerebro/scripts/validate-opencode-runtime.py` | Cerebro | Authoritative OpenCode runtime validator for config, plugin bridge, commands, agents, and model routing. |
48
+ | `.cerebro/scripts/validate-boulder.py` | Cerebro | Reusable doctor check for `.cerebro/boulder.json`. |
49
+ | `.cerebro/scripts/validate-team-runs.py` | Cerebro | Reusable doctor check for the team-run template and manifests. |
50
+ | `.cerebro/scripts/validate-upgrade-metadata.py` | Cerebro | Reusable doctor check for upgrade manifest and upgrade state metadata. |
51
+ | `.cerebro/scripts/write-upgrade-state.py` | Cerebro | Reusable helper that atomically writes upgrade baseline hashes. |
52
+ | `.cerebro/templates/plan.md` | Professor X | Canonical plan schema. |
53
+ | `.cerebro/templates/project-context.md` | Cerebro | Canonical repository index schema. |
54
+ | `.cerebro/project-context.md` | Cerebro | Indexed stack, commands, conventions, entrypoints, and risks. |
55
+ | `.cerebro/plans/*.md` | Professor X | Approved implementation plans. |
56
+ | `.cerebro/boulder.json` | Cerebro | Business-level execution checkpoint: active plan, overall status, approvals, verification history, and decisions. Task progress lives in `.cerebro/team-runs/{run-id}.tasks.json`. |
57
+ | `.cerebro/team-runs/{run-id}.json` | Cerebro | Run manifest for command, team name, teammates, approvals, mailbox decisions, verification, and cleanup. |
58
+ | `.cerebro/team-runs/{run-id}.tasks.json` | Cyclops | OpenCode-managed task ledger updated by `cerebro_task_create/list/update`. |
59
+ | `.cerebro/team-runs/{run-id}.mailbox.jsonl` | Cerebro team | Mailbox log written by `cerebro_mailbox_send` and read by `cerebro_mailbox_read`. |
60
+ | `.cerebro/team-runs/{run-id}.checkpoints.jsonl` | Cerebro team | Durable checkpoints written by `cerebro_checkpoint`. |
61
+ | `.cerebro/notepads/{plan}/conventions.md` | Cyclops | Coding patterns, naming, file structure, UI patterns. |
62
+ | `.cerebro/notepads/{plan}/commands.md` | Cyclops | Useful install/test/lint/build/dev commands. |
63
+ | `.cerebro/notepads/{plan}/decisions.md` | Cyclops | Approval decisions and architectural decisions. |
64
+ | `.cerebro/notepads/{plan}/gotchas.md` | Cyclops | Subtle traps, edge cases, unexpected behavior. |
65
+ | `.cerebro/notepads/{plan}/failures.md` | Cyclops | Failed approaches and why. |
66
+ | `.cerebro/notepads/{plan}/verification.md` | Cyclops | Verification commands and outcomes. |
67
+ | `.cerebro/notepads/{plan}/issues.md` | Cyclops | Blockers, deferred work, unresolved risks. |
68
+ | `.cerebro/pending-todos/{team}/{agent}/{task-id}.txt` | Wolverine / Storm | Task-scoped worker todos checked by `cerebro_verify_pending`. |
69
+ | `.cerebro/.pending-todos` | Wolverine / Storm | Legacy worker todo file kept for backward compatibility with old runs. |
70
+ | `.cerebro/upgrade-manifest.json` | Cerebro | Declares file ownership for `/cerebro-upgrade`. Controls which files are overwritten, merged, or left untouched. |
71
+ | `.cerebro/upgrade-state.json` | Cerebro | Baseline hashes written after each successful upgrade. Drives change detection on the next run. |
72
+ | `.cerebro/upgrade-cache/<ref>/` | Cerebro | Shallow clones of upstream refs (gitignored). |
73
+ | `.cerebro/schemas/upgrade-manifest.schema.json` | Cerebro | JSON Schema for the upgrade manifest. |
74
+ | `.cerebro/schemas/upgrade-state.schema.json` | Cerebro | JSON Schema for the upgrade state baseline. |
75
+
76
+ ## Upgrading from Upstream
77
+
78
+ `/cerebro-upgrade <ref>` syncs template-owned files from the configured upstream repo at an explicit pinned release or supported ref (for example `v0.3.0`). It never touches user-owned paths and gates all writes to merge-owned files.
79
+
80
+ ### How It Works
81
+
82
+ 1. **Arg validation** — `<ref>` must be an explicit tag or SHA; `HEAD`, `main`, and `master` are rejected.
83
+ 2. **Gate D** — checks for uncommitted changes in template/merge-owned paths before any write.
84
+ 3. **Fetch** — shallow-clones the upstream repo into `.cerebro/upgrade-cache/<ref>/`.
85
+ 4. **Classify** — each manifest entry is classified as `add`, `delete`, `modify-template`, `modify-merge-clean`, `modify-merge-conflict`, or `noop` by comparing local vs upstream content against the recorded baseline.
86
+ 5. **Apply** — template-owned files are written silently; merge-owned conflicts trigger Gate A.
87
+ 6. **Report** — a change table is printed to chat and written to `.cerebro/upgrade-cache/<ref>/report.md`.
88
+ 7. **Gate B** — if the upstream manifest differs from the local manifest, the user chooses how to reconcile.
89
+ 8. **State write** — `.cerebro/upgrade-state.json` is written atomically (tempfile+rename) with the applied SHA and post-upgrade working-tree file hashes.
90
+
91
+ ### Approval Gates
92
+
93
+ | Gate | Trigger | Choices |
94
+ |---|---|---|
95
+ | **Gate A** | Merge-owned file changed on both sides since baseline | keep local, take upstream, merge manually, skip |
96
+ | **Gate B** | Upstream manifest differs from local manifest | adopt upstream, merge entries, leave local |
97
+ | **Gate C** | Template-owned file drifted from baseline (`--strict` only) | overwrite, skip |
98
+ | **Gate D** | Uncommitted changes in owned paths | commit/stash first, or pass `--force-dirty` |
99
+
100
+ ### Flags
101
+
102
+ - `--dry-run` — show the change report without writing anything.
103
+ - `--strict` — pause Gate C before overwriting any template-owned file that has drifted locally.
104
+ - `--force-dirty` — continue after Gate D finds uncommitted changes in owned paths.
105
+ - `--only <glob>` — restrict the upgrade to files matching this glob.
106
+
107
+ ### v1 Known Gaps
108
+
109
+ - No automated rollback after partial success — use `git restore .` to undo any written files.
110
+ - Symlinks and executable bits are not preserved. Re-run release verification after upgrade before publishing.
111
+ - The default upstream remains the migration source unless overridden by command/script flags; fork remotes require explicit configuration.
112
+
113
+ ## Skills
114
+
115
+ Skills are optional overlays. They may improve task-specific execution or verification, but the base workflow must continue without them. `.cerebro` contracts, approval gates, and result envelopes stay authoritative when a skill gives conflicting advice.
@@ -0,0 +1,28 @@
1
+ # Orchestration System Guide
2
+
3
+ Cerebro turns OpenCode into a coordinated X-Men-themed agent workflow using native project files: `AGENTS.md`, `.opencode/agents/`, `.opencode/commands/`, the `open-xmen` plugin, and `.cerebro/` runtime state.
4
+
5
+ ## When To Use What
6
+
7
+ | Complexity | Approach | When to use |
8
+ |---|---|---|
9
+ | Simple | Ask normally | Explanation, small command, single obvious edit. |
10
+ | New repo or stale context | `/cerebro-index` | Build `.cerebro/project-context.md` before planning or execution. |
11
+ | Clear implementation | `/to-me-my-x-men [task]` | Clear goal, low/medium risk, no long interview needed. |
12
+ | Complex or risky | `/cerebro-plan [task]` then `/cerebro-start-work` | Multi-step feature, architecture change, migration, security, data, production impact. |
13
+ | Interrupted plan | `/cerebro-start-work` | Continue from `.cerebro/boulder.json`. |
14
+
15
+ If the user explicitly invokes `/to-me-my-x-men` for ambiguous or product-shaped work, Cerebro asks only for blockers it cannot infer safely. Otherwise Legion and Cypher record assumptions in customer/requirements notepads before Professor X, Beast, Emma Frost, Cyclops, and the workers proceed.
16
+
17
+ ## Layers
18
+
19
+ 1. Cerebro classifies the user request and reads `.cerebro/project-context.md` plus OpenCode routing guidance when it exists.
20
+ 2. Legion captures customer intent and Cypher converts it into requirements when autonomous mode needs product judgment.
21
+ 3. Professor X plans complex or risky work and writes `.cerebro/plans/{name}.md`.
22
+ 4. Cyclops creates/updates Cerebro task records and delegates to Wolverine, Storm, Forge, Nightcrawler, Sage, Beast, and Emma Frost.
23
+ 5. Workers report evidence; Cyclops verifies independently.
24
+ 6. Run manifests, task ledgers, mailbox logs, checkpoints, boulder state, and notepads are stored under `.cerebro/`.
25
+
26
+ ## Verification Standard
27
+
28
+ Worker self-report is not enough. Cyclops verifies by reading changed files, running the plan's verification commands, and sending failures back to the worker with exact output. Final synthesis happens only after `cerebro_verify_pending` confirms task-scoped todos are clear or explicitly blocked.
@@ -0,0 +1,44 @@
1
+ # Cerebro OpenCode Runtime
2
+
3
+ Cerebro is an OpenCode plugin/runtime that ports the original X-Men workflow into OpenCode while preserving the role names, cinematic command style, and high verification bar. It gives one project a repeatable planning and execution system using OpenCode-native files:
4
+
5
+ - `AGENTS.md` for repository-level Cerebro/OpenCode operating rules
6
+ - `.opencode/agents/*.md` for specialist personas
7
+ - `.opencode/commands/*.md` for slash command workflows
8
+ - `.opencode/plugins/open-xmen.ts` for the local development bridge
9
+ - `src/index.ts` for custom Cerebro tools and OpenCode plugin hooks
10
+ - `.cerebro/` for plans, execution state, and accumulated learnings
11
+
12
+ Legacy `.claude/` files may exist as migration source or compatibility material, but `.opencode/` + `.cerebro/` is the active runtime. Skills are optional overlays; the base workflow does not require any skill to be installed.
13
+
14
+ ## Quick Start
15
+
16
+ ```text
17
+ /to-me-my-x-men add request validation to the API
18
+ /cerebro-index
19
+ /cerebro-plan redesign the authentication flow
20
+ /cerebro-start-work
21
+ /cerebro-doctor
22
+ ```
23
+
24
+ ## Working Modes
25
+
26
+ | Mode | Command | Use when |
27
+ |---|---|---|
28
+ | Direct | Ask normally | The request is simple and low-risk. |
29
+ | Index | `/cerebro-index` | Build project context for faster future work. |
30
+ | Autonomous | `/to-me-my-x-men [task]` | The task is clear and should be executed end to end. |
31
+ | Planning | `/cerebro-plan [task]` | Requirements are complex, ambiguous, high-impact, or need approval. |
32
+ | Execution | `/cerebro-start-work` | A plan exists and should be executed or resumed. |
33
+ | Doctor | `/cerebro-doctor` | Validate workflow health and catch command/model/runtime drift. |
34
+ | Reset | `/cerebro-reset` | Safely scan and reset Cerebro runtime state after confirmation. |
35
+ | Upgrade | `/cerebro-upgrade` | Sync template-owned files from a pinned upstream ref. |
36
+
37
+ When `/to-me-my-x-men` receives an unclear full-product prompt, it asks only for non-inferable blockers. Otherwise Legion and Cypher document assumptions in customer/requirements notepads, Professor X promotes them into a brief or plan, and Cyclops coordinates verified execution.
38
+
39
+ ## Recommended Reading
40
+
41
+ - [Cerebro Workflow](./cerebro-workflow.md)
42
+ - [Orchestration Guide](./orchestration.md)
43
+ - [Skill Policy](./skill-policy.md)
44
+ - [Agent Mapping](./agent-mapping.md)
@@ -0,0 +1,25 @@
1
+ # Skill Policy
2
+
3
+ Cerebro ships without required skills. Skills can be added later as optional overlays.
4
+
5
+ ## Rules
6
+
7
+ - Skills are never required for the base workflow.
8
+ - Agents may use a relevant available skill when it improves implementation, research, or verification.
9
+ - If a skill is unavailable, agents continue with normal repo tools.
10
+ - Project-local instructions, `.cerebro` contracts, approval gates, todo discipline, model/effort routing, and result envelopes override skill advice.
11
+ - Skills must not bypass approval gates or weaken verification requirements.
12
+ - If skill availability changes what could be verified, report that limitation in `TASK_RESULT` or the final report.
13
+
14
+ ## Good Uses
15
+
16
+ - Storm uses an available browser or accessibility skill to verify UI behavior.
17
+ - Wolverine uses an available language or test skill to run a focused suite.
18
+ - Sage uses an available docs skill to fetch more precise API references.
19
+
20
+ ## Bad Uses
21
+
22
+ - A task fails only because an optional skill is missing.
23
+ - A skill-generated instruction overrides `.cerebro/templates/plan.md`.
24
+ - A skill bypasses a required approval gate.
25
+ - A worker omits the required `TASK_RESULT` envelope because a skill returned another format.
@@ -0,0 +1,30 @@
1
+ # Semble — Semantic Code Search
2
+
3
+ Semble is installed as an MCP server. The following teammates should prefer it over grep for natural-language and conceptual queries: **Nightcrawler**, **Wolverine**, and **Forge**.
4
+
5
+ ## MCP Tools
6
+
7
+ - `mcp__semble__search(query, repo)` — natural-language or identifier search; `repo` is a local path or git URL; defaults to the current working directory.
8
+ - `mcp__semble__find_related(file_path, line, repo)` — find chunks semantically similar to the code at a given file location.
9
+
10
+ ## When to Use Semble
11
+
12
+ - Conceptual / natural-language queries → `mcp__semble__search`
13
+ - "Find code similar to X" → `mcp__semble__find_related`
14
+ - Exhaustive exact-string or regex matching → use `grep` (semble is not a text matcher)
15
+
16
+ ## Per-Teammate Guidance
17
+
18
+ **Nightcrawler** — primary user. Prefer semble for all conceptual queries; fall back to grep only for exact-string or regex matching.
19
+
20
+ **Wolverine** — use `mcp__semble__search` before implementing to find existing patterns, conventions, and similar code to avoid duplication. Use `mcp__semble__find_related` to discover all call sites when changing an interface.
21
+
22
+ **Forge** — use `mcp__semble__search` to locate architectural examples and assess how widely a pattern is used before recommending changes. Use `mcp__semble__find_related` to find the blast radius of a design decision.
23
+
24
+ ## Indexing for Repeated Searches
25
+
26
+ Index once for faster repeated queries:
27
+ ```bash
28
+ semble index . -o .cerebro/semble-index
29
+ ```
30
+ Pass `--index .cerebro/semble-index` to searches. Reindex if the codebase changes significantly.
@@ -0,0 +1,37 @@
1
+ # Cerebro OpenCode Model Routing
2
+
3
+ This installation is configured to prefer the user's cost-conscious OpenAI model set. GPT-5.4 is the default frontier/strong lane; GPT-5.4 Pro is intentionally not the default because it is more expensive.
4
+
5
+ | Slot | Model | Use |
6
+ |---|---|---|
7
+ | `frontier` | `openai/gpt-5.4` | Cerebro, Professor X, Cyclops, Forge, Emma Frost, high-risk escalation |
8
+ | `strong` | `openai/gpt-5.4` | Legion, Cypher, Sage, Beast, routine analysis and review |
9
+ | `legacy-frontier` | `openai/gpt-5.2` | Compatibility/fallback if GPT-5.4 is unavailable or a task needs GPT-5.2-specific behavior |
10
+ | `coding` | `openai/gpt-5.3-codex` | Wolverine and Storm implementation/UI work |
11
+ | `spark` | `openai/gpt-5.3-codex-spark` | Instant code sketches, boilerplate, test stubs, tiny low-risk diffs, first-pass generation |
12
+ | `fast` | `openai/gpt-5.4-mini` | Nightcrawler fast indexing and repetitive search |
13
+ | `image` | `openai/gpt-image-2` | Image/design asset generation only |
14
+
15
+ Environment overrides:
16
+
17
+ - `CEREBRO_MODEL_FRONTIER` (set to `openai/gpt-5.4-pro` only when you explicitly want the premium lane)
18
+ - `CEREBRO_MODEL_STRONG`
19
+ - `CEREBRO_MODEL_CODING`
20
+ - `CEREBRO_MODEL_SPARK`
21
+ - `CEREBRO_MODEL_FAST`
22
+ - `CEREBRO_MODEL_IMAGE`
23
+
24
+ Routing policy: default to best performance within the available cost-conscious models. Use full `gpt-5.3-codex` for Wolverine/Storm coding by default. Use Spark as a draft lane for instant code generation, then route non-trivial implementation, verification, and final fixes through full Codex. Use `fast` only for low-risk search/indexing. Escalate coding blockers or validation disputes to `frontier`. If `frontier` is unavailable, fall back to `strong` (`openai/gpt-5.4`) before considering legacy compatibility models.
25
+
26
+
27
+ ## Spark Lane
28
+
29
+ Use `spark` when speed and creative first-pass output matter more than final confidence:
30
+
31
+ - component/function boilerplate
32
+ - first draft of a small helper
33
+ - test skeletons and fixtures
34
+ - quick patch candidates for Cyclops/Wolverine to review
35
+ - small examples or code snippets for plans/docs
36
+
37
+ Do not use Spark as the final authority for high-risk code, migrations, security-sensitive changes, broad refactors, or final verification.
@@ -0,0 +1,143 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Cerebro Boulder Execution State",
4
+ "description": "Business-level execution checkpoint. Task progress lives in .cerebro/team-runs/{run_id}.tasks.json via cerebro_task_* tools — do not duplicate it here.",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "active_plan",
10
+ "plan_name",
11
+ "status",
12
+ "risk_level",
13
+ "team_name",
14
+ "started_at",
15
+ "updated_at",
16
+ "approval_gates",
17
+ "verification_history",
18
+ "decisions"
19
+ ],
20
+ "properties": {
21
+ "version": {
22
+ "type": "integer",
23
+ "const": 2
24
+ },
25
+ "active_plan": {
26
+ "type": "string",
27
+ "description": "Path to the active .cerebro/plans/*.md plan, or an empty string before a plan is selected"
28
+ },
29
+ "plan_name": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ },
33
+ "status": {
34
+ "type": "string",
35
+ "enum": ["not_started", "in_progress", "blocked", "completed"]
36
+ },
37
+ "risk_level": {
38
+ "type": "string",
39
+ "enum": ["LOW", "MEDIUM", "HIGH"]
40
+ },
41
+ "team_name": {
42
+ "type": "string",
43
+ "description": "Active team/session name used to group Cerebro tasks, mailbox messages, checkpoints, and pending todos"
44
+ },
45
+ "started_at": {
46
+ "type": "string",
47
+ "minLength": 1
48
+ },
49
+ "updated_at": {
50
+ "type": "string",
51
+ "minLength": 1
52
+ },
53
+ "approval_gates": {
54
+ "type": "array",
55
+ "items": {
56
+ "$ref": "#/$defs/approval_gate"
57
+ }
58
+ },
59
+ "verification_history": {
60
+ "type": "array",
61
+ "items": {
62
+ "$ref": "#/$defs/verification_entry"
63
+ }
64
+ },
65
+ "decisions": {
66
+ "type": "array",
67
+ "description": "Architectural and approval decisions made during execution",
68
+ "items": {
69
+ "$ref": "#/$defs/decision"
70
+ }
71
+ }
72
+ },
73
+ "$defs": {
74
+ "approval_gate": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["name", "status", "decided_at", "decision_by", "notes"],
78
+ "properties": {
79
+ "name": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ },
83
+ "status": {
84
+ "type": "string",
85
+ "enum": ["pending", "approved", "rejected"]
86
+ },
87
+ "decided_at": {
88
+ "type": ["string", "null"]
89
+ },
90
+ "decision_by": {
91
+ "type": ["string", "null"]
92
+ },
93
+ "notes": {
94
+ "type": "string"
95
+ }
96
+ }
97
+ },
98
+ "verification_entry": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["command", "result", "verified_at", "notes"],
102
+ "properties": {
103
+ "command": {
104
+ "type": "string",
105
+ "minLength": 1
106
+ },
107
+ "result": {
108
+ "type": "string",
109
+ "enum": ["PASS", "FAIL", "BLOCKED"]
110
+ },
111
+ "verified_at": {
112
+ "type": "string",
113
+ "minLength": 1
114
+ },
115
+ "notes": {
116
+ "type": "string"
117
+ }
118
+ }
119
+ },
120
+ "decision": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "required": ["at", "topic", "decision", "rationale"],
124
+ "properties": {
125
+ "at": {
126
+ "type": "string",
127
+ "minLength": 1
128
+ },
129
+ "topic": {
130
+ "type": "string",
131
+ "minLength": 1
132
+ },
133
+ "decision": {
134
+ "type": "string",
135
+ "minLength": 1
136
+ },
137
+ "rationale": {
138
+ "type": "string"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }