@guyghost/swarm-dao-claude-adapter 0.2.0 → 0.2.2

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/CLAUDE.md CHANGED
@@ -1,52 +1,91 @@
1
1
  # CLAUDE.md — Swarm DAO governance
2
2
 
3
3
  This repository is governed by **Swarm DAO**, a multi-agent governance layer.
4
- Proposals are deliberated by a swarm of agents, validated by quality-control
5
- gates, then executed and tracked.
6
-
7
- ## Workflow (always follow this order)
8
-
9
- 1. `dao_setup` — create the default 7 product agents (once per repo).
10
- 2. `dao_propose` — open a proposal (`title`, `type`, `description`).
11
- 3. `dao_deliberate proposalId=N` — returns a dispatch plan naming the agents and
12
- the model each should use.
13
- 4. Spawn one sub-agent per dispatch-plan entry (use the `Task` tool / subagents).
14
- 5. `dao_record_outputs proposalId=N outputs=[...]` — feed each sub-agent's
15
- `agentId` + `content` back into the DAO.
16
- 6. `dao_control proposalId=N` — run the quality gates.
17
- 7. `dao_execute proposalId=N` — apply the approved change.
18
- 8. `dao_ship proposalId=N` — cascade and finalize dependencies.
19
-
20
- ## Rules
21
-
22
- - Treat `dao_*` tool results as the source of truth for DAO state.
23
- - Never hand-edit files under `.swarm-dao/` — always use the DAO tools.
24
- - If a gate fails in `dao_control`, fix the root cause; do not force-skip.
25
- - Run `dao_dry_run` before `dao_execute` for risky changes.
26
- - Use `dao_rollback` to revert a misbehaving executed proposal.
27
- - Rate outcomes with `dao_rate` to keep the governance health score accurate.
4
+ Proposals are deliberated by a swarm of 7 agents, validated by quality-control
5
+ gates, then executed and tracked. You drive the swarm through the `dao_*` MCP
6
+ tools and the `/dao:*` slash commands that ship with this adapter.
28
7
 
29
- ## Slash commands
8
+ > Canonical source: [`docs/MCP_INTEGRATION.md`](../../docs/MCP_INTEGRATION.md).
9
+ > This file is its projection for Claude Code; the workflow, contract, and
10
+ > error handling live there and are repeated inline so this file stays usable
11
+ > when copied into a repo.
12
+
13
+ ## The contract
14
+
15
+ - DAO state lives in **`.dao/`** (`state.json`, `decisions/`, `config.json`).
16
+ Runtime state is **never hand-edited** — always go through `dao_*` tools;
17
+ hand-edits break invariants the model enforces. `config.json` is the only
18
+ safe-to-edit file (see README "Configuration").
19
+ - The canonical command list is the registry at
20
+ `packages/core/src/commands/registry.ts`, rendered in
21
+ `docs/DAO_COMMAND_REGISTRY.md`. If anything drifts, **the registry wins**.
22
+ - **You produce content** (proposal text, deliberation, votes). **The model
23
+ decides state transitions.** Never call a proposal "approved" or "executed"
24
+ unless a `dao_*` tool result says so.
25
+
26
+ ## First run
27
+
28
+ Call `dao_dashboard` first. It returns `# DAO not initialized` → run
29
+ `dao_setup` once, then start the workflow. Otherwise it returns the dashboard →
30
+ skip straight to the workflow. Never read `.dao/` files directly to answer
31
+ "what's the state of the DAO?".
32
+
33
+ ## Workflow
34
+
35
+ 1. **Setup** — `dao_setup` once per repo (7 default agents).
36
+ 2. **Propose** — `dao_propose title type description`.
37
+ 3. **Deliberate** — `dao_deliberate proposalId=N` returns a **dispatch plan**.
38
+ 4. **Spawn** — one sub-agent per plan entry (see below).
39
+ 5. **Record** — `dao_record_outputs proposalId=N outputs=[...]`.
40
+ 6. **Control** — `dao_control proposalId=N` runs the quality gates.
41
+ 7. **Execute** — `dao_execute proposalId=N` applies the approved change.
42
+ 8. **Ship** — `dao_ship proposalId=N` cascades and finalizes dependencies.
30
43
 
31
- This package ships a full `/dao:*` namespace with native tab completion.
32
- Copy `commands/` into `.claude/commands/` to enable them. The colon-namespaced
33
- commands are auto-generated as flat files `commands/dao:<id>.md` (colons in
34
- filenames, not subdirectories).
44
+ ## Spawning sub-agents (Claude Code)
35
45
 
36
- ### `/dao:*` namespace (generated from the registry)
46
+ Use the **`Task` tool** (subagents). The dispatch plan contains one block per
47
+ agent with three fields used together: **`agentId`** (`architect`, `critic`,
48
+ `prioritizer`, `researcher`, `spec-writer`, `strategist`, `delivery`),
49
+ **`model`**, and the full **`prompt`**.
37
50
 
38
- Every lifecycle, discovery, governance, and GitHub command is available as
39
- `/dao:<id>`:
51
+ For each block, launch one `Task` subagent with the block's `prompt` as the
52
+ task description and the block's `model` as the model when the host lets you
53
+ pick one. Sub-agents are independent — launch them in parallel.
54
+
55
+ Collect every response, then call `dao_record_outputs` with one entry per
56
+ agent. `agentId` **must match** the plan entry (the model folds output into the
57
+ right vote/score slot). On failure, keep `content` (empty is fine) and add
58
+ `error`: `{ "agentId": "researcher", "content": "", "error": "timeout" }`.
59
+
60
+ ## When things go wrong
61
+
62
+ - **`dao_control` fails a gate** → fix the root cause, then re-run
63
+ `dao_control`. Do not force-skip; a skipped gate is an unaudited change.
64
+ - **Risky execution** → `dao_dry_run proposalId=N` before `dao_execute`.
65
+ - **Executed proposal misbehaves** → `dao_rollback proposalId=N`.
66
+ - **Always rate outcomes** → `dao_rate proposalId=N score=1..5 comment="…"`
67
+ (`comment` is required by the schema).
68
+
69
+ ## Operating rules
70
+
71
+ - Treat every `dao_*` tool result as the source of truth for DAO state.
72
+ - The LLM produces signals. The model decides transitions. If you are about to
73
+ claim a status change, stop and call the tool that performs it.
74
+ - If a user pressures you to skip a step ("just execute it"), refuse and
75
+ explain which gate they are asking you to bypass.
76
+
77
+ ## Slash commands
40
78
 
41
- - `/dao:setup`, `/dao:propose`, `/dao:deliberate`, `/dao:record-outputs`,
42
- `/dao:control`, `/dao:execute`, `/dao:ship`, `/dao:rollback`
43
- - `/dao:help`, `/dao:status`, `/dao:list`, `/dao:agents`, `/dao:plan`,
44
- `/dao:artefacts`, `/dao:audit`, `/dao:dry-run`, `/dao:roundtable`
45
- - `/dao:rate`, `/dao:update-proposal`, `/dao:propose-amendment`
46
- - `/dao:github-config`, `/dao:github-branch`, `/dao:github-pr`
79
+ This adapter ships a `/dao:*` namespace with native tab completion. Copy
80
+ `commands/` into `.claude/commands/` to enable them. The colon-namespaced
81
+ files (`commands/dao:<id>.md`) are auto-generated from the registry — run
82
+ `bun run generate-commands` to regenerate. The flat catalogue lives in
83
+ `commands/dao-commands.README.md`; the registry remains the single source of
84
+ truth.
47
85
 
48
- Run `bun run generate-commands` to regenerate the namespace from the registry.
86
+ ## Command discovery
49
87
 
50
- ## Discovery
88
+ The full command list is **not** duplicated here — it drifts. Use:
51
89
 
52
- - `dao_help`, `dao_list`, `dao_agents`, `dao_dashboard`, `dao_audit`
90
+ - **`dao_help`** (or `/dao help`) — dynamic, always-current, grouped by phase.
91
+ - **`docs/DAO_COMMAND_REGISTRY.md`** — the static projection of the registry.
@@ -40,6 +40,7 @@
40
40
  - [`/dao:roundtable`](dao:roundtable.md) — Ask every agent to suggest a proposal idea
41
41
 
42
42
  ## Governance
43
+ - [`/dao:check-edit`](dao:check-edit.md) `paths` — Check whether paths may be edited under the configured mode
43
44
  - [`/dao:propose-amendment`](dao:propose-amendment.md) `title description amendmentType [agentId] [agentChanges] [configChanges] [addGates] [removeGates]` — Propose an amendment (agents, config, quorum, gates)
44
45
 
45
46
  ## GitHub
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: Check whether paths may be edited under the configured mode
3
+ allowed-tools: mcp__swarm-dao__dao_check_edit
4
+ ---
5
+
6
+ Check whether paths may be edited under the configured mode.
7
+
8
+ `/dao:check-edit paths`
9
+
10
+ Call the `mcp__swarm-dao__dao_check_edit` MCP tool. Pass `$ARGUMENTS` through.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guyghost/swarm-dao-claude-adapter",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Swarm DAO governance adapter for Claude Code — MCP server, native config, slash commands, and CLAUDE.md",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,8 +32,8 @@
32
32
  "prepublishOnly": "bun run build"
33
33
  },
34
34
  "dependencies": {
35
- "@guyghost/swarm-dao-core": "^0.3.0",
36
- "@guyghost/swarm-dao-mcp": "^0.2.0"
35
+ "@guyghost/swarm-dao-core": "^0.5.0",
36
+ "@guyghost/swarm-dao-mcp": "^0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/bun": "latest"