@rryando/arcs 4.1.0 → 4.2.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 (59) hide show
  1. package/README.md +17 -19
  2. package/dist/cli/arcs-flash.d.ts +1 -1
  3. package/dist/cli/arcs-flash.d.ts.map +1 -1
  4. package/dist/cli/arcs-flash.js +9 -50
  5. package/dist/cli/arcs-flash.js.map +1 -1
  6. package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -2
  7. package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
  8. package/dist/cli/arcs-orchestrate-caveman.js +2 -8
  9. package/dist/cli/arcs-orchestrate-caveman.js.map +1 -1
  10. package/dist/cli/arcs-orchestrate.d.ts +1 -1
  11. package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
  12. package/dist/cli/arcs-orchestrate.js +4 -54
  13. package/dist/cli/arcs-orchestrate.js.map +1 -1
  14. package/dist/cli/orchestrator-shared-blocks.d.ts +10 -30
  15. package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -1
  16. package/dist/cli/orchestrator-shared-blocks.js +46 -128
  17. package/dist/cli/orchestrator-shared-blocks.js.map +1 -1
  18. package/dist/utils/diagram-generator.d.ts.map +1 -1
  19. package/dist/utils/diagram-generator.js +11 -6
  20. package/dist/utils/diagram-generator.js.map +1 -1
  21. package/opencode/arcs/bundle-runtime.json +0 -3
  22. package/opencode/arcs/manifest.json +8 -25
  23. package/opencode/arcs/prompts/arcs-docs.txt +19 -157
  24. package/opencode/arcs/prompts/arcs-flash.txt +49 -152
  25. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +47 -165
  26. package/opencode/arcs/prompts/arcs-orchestrate.txt +46 -158
  27. package/opencode/arcs/prompts/code-reviewer.txt +20 -60
  28. package/opencode/arcs/prompts/graph-explorer.txt +19 -49
  29. package/opencode/arcs/prompts/software-engineer.txt +21 -67
  30. package/opencode/arcs/prompts/tech-architect.txt +20 -130
  31. package/opencode/arcs/skills/brainstorming/SKILL.md +20 -100
  32. package/opencode/arcs/skills/brainstorming/visual-companion.md +6 -264
  33. package/opencode/arcs/skills/caveman-commit/SKILL.md +6 -43
  34. package/opencode/arcs/skills/deep-pr-review/SKILL.md +18 -200
  35. package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +7 -93
  36. package/opencode/arcs/skills/deep-pr-review/review-template.md +13 -60
  37. package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +16 -156
  38. package/opencode/arcs/skills/implementation/SKILL.md +20 -46
  39. package/opencode/arcs/skills/init-project/SKILL.md +12 -150
  40. package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +13 -133
  41. package/opencode/arcs/skills/systematic-debugging/SKILL.md +13 -152
  42. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +7 -110
  43. package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +7 -119
  44. package/opencode/arcs/skills/systematic-debugging/phases-reference.md +9 -166
  45. package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +8 -165
  46. package/opencode/arcs/skills/test-driven-development/SKILL.md +10 -61
  47. package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +7 -154
  48. package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +8 -295
  49. package/opencode/arcs/skills/to-diagram/SKILL.md +18 -206
  50. package/opencode/arcs/skills/writing-knowledge/SKILL.md +11 -63
  51. package/opencode/arcs/skills/writing-plans/SKILL.md +25 -118
  52. package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +10 -61
  53. package/package.json +1 -1
  54. package/skills/explore-dag.md +9 -52
  55. package/skills/init-project.md +9 -98
  56. package/skills/orchestrate.md +15 -109
  57. package/skills/update-docs.md +9 -60
  58. package/opencode/arcs/prompts/devil-advocate.txt +0 -79
  59. package/opencode/arcs/skills/executing-plans/SKILL.md +0 -49
@@ -1,61 +1,35 @@
1
1
  ---
2
2
  name: implementation
3
- description: Use for orchestrator-selected bounded or inspect implementation work. Bounded executes a fully specified change directly; inspect resolves limited uncertainty from the repo and DAG before coding.
3
+ description: Inspect, edit, verify, or execute a ready plan node
4
4
  ---
5
5
 
6
- # Skill: implementation
6
+ # Implementation
7
7
 
8
- ## Work Mode Is Dispatch Authority
8
+ ## Work Modes
9
9
 
10
- The orchestrator selects exactly one work mode in the dispatch: `bounded` or `inspect`. Do not re-route yourself or silently expand scope.
10
+ `bounded`, `inspect`, and `plan-node` are hints, not lifecycle gates:
11
11
 
12
- ### `bounded`
12
+ - **bounded:** the requested files and behavior are already clear; start directly.
13
+ - **inspect:** inspect the smallest repository surface needed to resolve implementation details.
14
+ - **plan-node:** check declared dependencies, execute the current ready node within its scope, run relevant verification, and align task and diagram state through the ARCS CLI. Never edit DAG files or diagrams directly, execute a blocked node, or absorb an adjacent outcome.
13
15
 
14
- Use when the task, files, acceptance criteria, and VERIFY command are fully specified.
16
+ In any mode, ask only when evidence cannot resolve a change to the goal, material scope, dependency strategy, or risk.
15
17
 
16
- - Execute directly with no repo exploration and no user questions.
17
- - Read only the dispatched files and context needed to make the change.
18
- - If a material decision or hidden scope appears, stop and return `STATUS: blocked`; do not guess or switch modes.
18
+ ## Method
19
19
 
20
- ### `inspect`
20
+ 1. Inspect relevant code and tests.
21
+ 2. Reuse existing patterns and dependencies.
22
+ 3. Edit the minimum code needed for a complete result.
23
+ 4. Add proportionate tests for changed behavior.
24
+ 5. Verify with targeted checks; use broader checks for broad or high-risk work.
25
+ 6. If verification fails, fix failures caused by the change and rerun the relevant check.
21
26
 
22
- Use when the goal is clear but limited implementation details remain.
27
+ For `plan-node`, read the current node metadata, confirm every predecessor is done, and use ARCS CLI task and diagram commands to keep completion state aligned. If dependencies are unmet or the node conflicts with its scope, stop with the concrete blocker instead of selecting other work.
23
28
 
24
- 1. Inspect the repository and DAG first: search relevant knowledge, then inspect the smallest set of patterns, types, callers, and tests that can resolve the decision.
25
- 2. Infer the answer when tools or established conventions make it clear.
26
- 3. Ask at most one targeted user question, and only for a material decision that is not tool-resolvable.
27
- 4. If uncertainty is design-shaping or scope expands, stop and return `STATUS: blocked` rather than improvising.
29
+ Prefer necessity standard library platform capability installed dependency minimum custom code. Do not simplify away security, accessibility, validation, error handling, or data-loss protection.
28
30
 
29
- ## Construction Discipline
31
+ Do not commit, push, deploy, or modify unrelated files without an explicit request.
30
32
 
31
- Before adding code, stop at the first rung that satisfies the requirement:
33
+ ## Return
32
34
 
33
- 1. **Necessity** omit speculative or unrequested work.
34
- 2. **Standard library** — use it when it correctly covers the need.
35
- 3. **Native platform** — prefer a built-in platform capability.
36
- 4. **Installed dependency** — reuse one before adding code or a dependency.
37
- 5. **Minimum code** — write only the smallest correct implementation.
38
-
39
- Do not introduce abstractions, configuration, scaffolding, or dependencies for hypothetical consumers. Minimal does not mean flimsy: never simplify away security controls, accessibility basics, trust-boundary validation, or error handling that prevents data loss.
40
-
41
- Mark every deliberate simplification with its known ceiling and concrete revisit trigger:
42
-
43
- ```
44
- // SHORTCUT: <ceiling>, upgrade when <trigger>
45
- ```
46
-
47
- ## Implementation And Verification
48
-
49
- - Follow existing repository conventions and the dispatch SCOPE.
50
- - Use test-driven-development when the dispatch requires it or when adding non-trivial behavior; structural changes may rely on existing focused contracts.
51
- - Run exactly the dispatch VERIFY command, scoped to touched files. NEVER the full suite, project-wide lint, or full build.
52
- - Fix failures in touched files and re-run VERIFY. Report failures originating outside SCOPE under `BLOCKED_BY`; do not edit those files.
53
- - Never commit unless explicitly asked.
54
-
55
- ## Knowledge Exit
56
-
57
- Knowledge is proposal-only. For a durable, non-obvious pattern or gotcha, return a substantive ready-to-run proposal for orchestrator persistence at fan-in; do not execute `arcs knowledge upsert` yourself. Skip mechanical or easily re-derived observations.
58
-
59
- `arcs knowledge template --kind=<kind> --json`; `arcs knowledge upsert <slug> "<title>" --kind=<pattern|gotcha|lesson|architecture|decision> --summary="<summary>" --body="<substantive filled template>" --keywords="<keywords>" --source-files="<path[:anchor]>" --json`
60
-
61
- Upsert is idempotent by title.
35
+ Report changed files, verification actually run, remaining risk, and blockers.
@@ -1,160 +1,22 @@
1
1
  ---
2
2
  name: init-project
3
- description: Use when initializing a new ARCS project bootstrapping a repo into the DAG with metadata, docs, and structural knowledge entries. Covers gather → present summary → init → codegraph ingestion → fan-out analysis across typed sub-agents.
3
+ description: Initialize a repository as an ARCS project with useful minimal metadata
4
4
  ---
5
5
 
6
- # Skill: init-project
6
+ # Initialize Project
7
7
 
8
- ## When
8
+ ## Method
9
9
 
10
- User wants to track a new project, bootstrap documentation, or connect a repo to the ARCS DAG. Triggers: "new project", "track this repo", "add project X", "init <repo>".
10
+ An explicit request to init or track a project authorizes the local ARCS initialization. Ask only for missing user-owned identity such as name, description, workspace path, or dependency choice.
11
11
 
12
- > **Canonical orchestrator workflow:** `src/cli/arcs-orchestrate.ts` under `### INIT Workflow` — this skill mirrors that flow with full operational detail. If the two diverge, the orchestrator prompt wins.
12
+ 1. Check slug conflicts with `arcs project list`.
13
+ 2. Verify named dependency projects exist.
14
+ 3. Run `arcs project init` with the requested metadata.
15
+ 4. Add only requested or clearly useful overview/dependency documentation.
16
+ 5. Validate the new project and report its slug and paths.
13
17
 
14
- ## Flow
18
+ Codegraph is optional. When available, initialization may index the workspace and emit structural proposals. When absent, continue without it. If `pending_enrichment` is true, process useful proposals with `enriching-codegraph-proposals`; do not require a broad agent fan-out.
15
19
 
16
- ```mermaid
17
- flowchart TD
18
- classDef sub fill:#8b5cf6,color:#fff
20
+ Raw proposals are not knowledge. Inspect them before keep, merge, drop, or promote decisions. Never infer destructive cleanup, deployment, publication, or Git permission from initialization.
19
21
 
20
- A[Gather: name, description, repoUrl?, dependsOn?] --> B[arcs project list conflict check]
21
- B --> C[Present summary to user]
22
- C -->|user confirms| D[arcs project init]
23
- D --> E[arcs project update-doc × 4]
24
- E --> F{codegraph on PATH?}
25
- F -->|yes| G[codegraph index --force --quiet]
26
- F -->|no| H[Skip graph step, log gap]
27
- G --> G2[ingestGraph → ≤20 proposals]
28
- G2 --> G3[Enrich queue: list → keep/merge/drop → promote/drop]
29
- G3 --> I[Fan out: tech-architect analysis + research modes]:::sub
30
- H --> I
31
- I --> K[Done]
32
- ```
33
-
34
- ## CLI Primer
35
-
36
- ```bash
37
- arcs project init "Foo" --description="..." --path="$(pwd)" --json
38
- ```
39
- Discovery: `arcs --commands --json`. Mutating commands run directly — no token.
40
-
41
- ## Constraints
42
-
43
- - Do NOT read repo to infer name/description — gather from user
44
- - Verify `dependsOn` targets exist via `arcs project list --json`
45
- - `arcs project init` creates empty `plans/`, `knowledge/`, `tasks/` indexes — don't pre-populate
46
- - Repo analysis is **fan-out across typed agents**, never a generic "analysis sub-agent" (see Agent Dispatch below)
47
- - Never block INIT on codegraph — it's optional. Skip cleanly if missing.
48
-
49
- ## Codegraph Sub-Flow (DEFAULT: ON when binary present)
50
-
51
- The orchestrator runs codegraph directly during INIT to produce structural **proposals** before any sub-agent reads code. Proposals are durable on the proposal-store ledger; agents enrich them into knowledge entries via the `enriching-codegraph-proposals` skill. This is the default path when `codegraph` is on PATH; skip cleanly otherwise.
52
-
53
- 1. **Detect:** call `detectCodegraph()` from `src/utils/codegraph.ts`. If unavailable, log "codegraph not on PATH; proceeding without graph signal" and skip steps 3–6.
54
- 2. **Trust the gitignore guarantee:** `runIndex()` already auto-appends `.codegraph/` to `.gitignore` via `ensureGitignoreEntry`. Do NOT redundantly check or modify `.gitignore` from agents — running the index is sufficient.
55
- 3. **Index** (project-based; CLI drives the bundled runtime — no LLM API key required):
56
- ```bash
57
- codegraph index <workspacePath> --force --quiet
58
- ```
59
- Builds a per-project codegraph index under `<workspacePath>/.codegraph/`.
60
- 4. **Ingest as proposals:** `arcs project init` internally calls `ingestGraph(slug)`, which parses codegraph CLI `--json` output and writes up to 20 structural proposals to `proposals/graphify.json` (filename retained for compatibility; rename pending; test files filtered):
61
- - 8 god nodes (`kind=module`, ranked by callers+callees / impact as a proxy for degree)
62
- - 8 architecture clusters (`kind=architecture`, synthesized pseudo-communities by directory prefix — codegraph has no community/cluster export)
63
- - 5 cross-module couplings (`kind=gotcha`, high-degree links across top-level dirs; relations hard-coded as `["calls"]`)
64
-
65
- Codegraph never writes directly to the knowledge surface. The init envelope returns `data.codegraph.pending_enrichment: true` to signal that proposals are waiting.
66
- 5. **Enrich** with the `enriching-codegraph-proposals` skill — read `arcs proposal list <slug> --json`, decide per-proposal verdicts (keep / merge / drop), and return exact proposed promote/drop commands for orchestrator application. Pending codegraph proposals never bypass this lifecycle into knowledge.
67
- 6. **Optional graph queries** for evidence during enrichment (sub-agents may run these via the codegraph MCP server, which auto-syncs through its own file watcher):
68
- - `codegraph_search "entry points and main commands"` → seeds for "key files" reference entries
69
- - `codegraph_explore` on core modules → seeds for "core modules" entries
70
- - `codegraph_node "<godNodeLabel>"` → structural summary for module entry bodies
71
- - `codegraph_impact "<critical-symbol>"` → reverse-impact map for high-risk modules
72
- - `codegraph_callers` / `codegraph_callees "<symbol>"` → dependency paths for architecture entries
73
- 7. **Hand to typed agents** (in parallel) for independently authored, code-grounded follow-up entries beyond the proposal queue — see **Agent Dispatch** below.
74
-
75
- ## Content Guidelines
76
-
77
- | Doc | Format |
78
- |-----|--------|
79
- | `overview.md` | 2-3 sentence summary + goals |
80
- | `tasks.md` | `[ ]` backlog / `[/]` in-progress / `[x]` done |
81
- | `dependencies.md` | Upstream + downstream sections |
82
- | `knowledge.md` | High-level context + pointers to structured entries |
83
-
84
- Update via `arcs project update-doc <slug> <doc> --content="..."`.
85
-
86
- ## Agent Dispatch (named typed agents — DO NOT default to a generic analysis agent)
87
-
88
- | Sub-agent | Owns | Knowledge kinds it produces |
89
- |-----------|------|----------------------------|
90
- | `tech-architect` (analysis mode) | Module boundaries, clusters, dependency direction, cross-module couplings, structural gotchas, lessons | `architecture`, `module`, `gotcha`, `lesson` |
91
- | `tech-architect` (`AGENT_MODE: research`) | Tech stack, third-party libraries, key files, features | `reference`, `feature` |
92
- | `code-reviewer` (audit mode, optional) | Coding-style + convention scan from existing code | `pattern` |
93
-
94
- Dispatch in parallel — all agents in one message, per the orchestrator's Parallelism rules. Each agent receives:
95
- - The relevant `KnowledgeProposal` records from `ingestGraph` (so they don't rediscover what codegraph already found)
96
- - Targeted codegraph queries for evidence (e.g., `codegraph_node` / `codegraph_impact` output for the modules they own)
97
- - Explicit scope (which files / which kinds to produce)
98
-
99
- Raw `KnowledgeProposal` records stay in the proposal lifecycle above. Each typed agent may instead return an independently authored finding: `{title, kind, summary, keywords, sourceFiles, body}`. Workers do not execute `arcs knowledge upsert`; after deduplication they return substantive ready-to-run commands for orchestrator fan-in persistence.
100
-
101
- ## Knowledge Categories for Analysis Sub-Agents
102
-
103
- | Category | Kind | What to discover | Primary agent |
104
- |----------|------|------------------|---------------|
105
- | tech stack | `architecture` | Languages, frameworks, runtimes, build tools, versions | `tech-architect` (`AGENT_MODE: research`) |
106
- | key files | `reference` | Entry points, config files, main modules, purposes | `tech-architect` (`AGENT_MODE: research`; use `codegraph_search "entry points"`) |
107
- | code patterns | `pattern` | Recurring design patterns, abstractions, error handling | `code-reviewer` (audit mode) or `tech-architect` |
108
- | coding style | `pattern` | Formatting, linting, import ordering, file organization | `code-reviewer` (audit mode) |
109
- | core modules | `module` | Core modules / shared functions — what, where, interconnections | `tech-architect` (god nodes from codegraph) |
110
- | external services | `module` | APIs, databases, message queues the project interacts with | `tech-architect` (`AGENT_MODE: research`) |
111
- | third-party libraries | `reference` | Key dependencies and why they are used | `tech-architect` (`AGENT_MODE: research`) |
112
- | features | `feature` | Major user-facing or system-facing features | `tech-architect` (`AGENT_MODE: research`) |
113
- | cross-module couplings | `gotcha` | Hot edges between modules surfaced by codegraph | `tech-architect` (auto from `ingestGraph`) |
114
- | architecture clusters | `architecture` | Pseudo-community / directory groupings from codegraph | `tech-architect` (auto from `ingestGraph`) |
115
-
116
- ## Worked Example
117
-
118
- ```bash
119
- # 1. Conflict check
120
- arcs project list --json
121
-
122
- # 2. Present summary to user; on confirmation, init
123
- arcs project init "Foo" --description="Foo CLI tool" --path="$(pwd)" --json
124
-
125
- # 3. Update docs
126
- arcs project update-doc foo overview --content="..." --json
127
- # ... repeat for tasks, dependencies, knowledge
128
-
129
- # 4. Codegraph (if available) — runs inside `arcs project init`
130
- codegraph index . --force --quiet
131
- # ingestGraph parses codegraph CLI --json → proposals/graphify.json (filename retained; rename pending)
132
- # init envelope: data.codegraph.pending_enrichment === true → load
133
- # `enriching-codegraph-proposals` and run the verdict loop:
134
- arcs proposal list foo --json
135
- # keep: promote only after authoring the required title, summary, body, and source files
136
- arcs proposal promote foo <id> --title="..." --summary="..." --body-file=... --kind=module --source-files=... --json
137
- # merge: promote with --merge-with=<existing-knowledge-id> and append graph evidence
138
- arcs proposal promote foo <id> --merge-with=<existing-knowledge-id> --body-file=... --source-files=... --json
139
- arcs proposal drop foo <id> --reason="..." --json
140
-
141
- # 5. Fan out typed agents (parallel) for entries beyond proposal scope
142
- # tech-architect (analysis mode) → architecture/module/gotcha/lesson entries
143
- # tech-architect (AGENT_MODE: research) → reference/feature entries
144
-
145
- # 6. Propose only independently authored, non-proposal-derived findings.
146
- # Obtain the kind-specific body anatomy before authoring the ready-to-run command:
147
- arcs knowledge template --kind=architecture --json
148
- arcs knowledge upsert foo "Tech stack: TypeScript + Node 20" --kind=architecture --summary="..." --body-file=... --source-files=package.json --json
149
- # Return the upsert; do not execute it. The orchestrator persists it at fan-in.
150
- ```
151
-
152
- ## Exit Conditions
153
-
154
- | Condition | Action |
155
- |-----------|--------|
156
- | Project already in DAG (slug collision) | Stop. Surface conflict; ask user to rename or use existing |
157
- | User declines summary | Stop. No mutations performed |
158
- | `codegraph` missing | Continue without graph signal; sub-agents run with code reading only |
159
- | `dependsOn` target missing | Stop. Ask user to init dependencies first or remove the link |
160
- | Init succeeds but knowledge fan-out fails | Project exists in DAG; rerun knowledge phase later via SYNC |
22
+ If a write fails, stop and report partial state instead of layering more mutations on an uncertain project.
@@ -1,143 +1,23 @@
1
1
  ---
2
2
  name: install-claude-code-hook
3
- description: Use when retrofitting the Claude Code session-bridge hook onto an already-inited ARCS project — triggers "install the claude code hook", "enable session bridge", "set up hook for this project", "hook up claude code to arcs", "the arcs web UI can't see my session". Claude Code only; detects existing state, then installs after explicit confirmation.
3
+ description: Install the ARCS session-bridge hook into an existing Claude Code workspace
4
4
  ---
5
5
 
6
- # Skill: install-claude-code-hook
6
+ # Install Claude Code Hook
7
7
 
8
- ## When
8
+ ## Boundary
9
9
 
10
- The project is already in the DAG but its workspace never got the session-bridge hook — usually because `arcs project init` predated the offer, or the offer was declined. Triggers: "install the claude code hook", "enable session bridge", "set up hook for this project", "hook up claude code to arcs", "the arcs web UI can't see my session".
10
+ Claude Code only. If the current harness is not Claude Code, stop. The hook changes `.claude/settings.local.json`, so obtain explicit confirmation before using `--write`.
11
11
 
12
- > **Claude-Code-only skill.** Step 0 is self-knowledge, not detection: if you are not running as Claude Code, say so and stop. The hook registers into Claude Code's own settings file; installing it from another harness configures a client that will never run it. There is no environment-variable heuristic here by design — you know your own harness.
12
+ ## Method
13
13
 
14
- > **Executes, unlike the proposal skills.** After explicit user confirmation this skill runs `arcs hooks install-claude-code <slug> --write` itself. That is not a `writing-knowledge`-style "propose, don't execute" case: the write is local machine config (`.claude/settings.local.json`), not a durable ARCS DAG mutation. It mirrors `promptAndInstallClaudeCodeHook`, which already executes directly inside `arcs project init` behind the same confirm.
14
+ 1. Run `arcs hooks status <slug> --json`.
15
+ 2. If already installed for this slug, report a no-op.
16
+ 3. Explain the file written, registered events, local token, and that a new Claude Code session is required.
17
+ 4. If the hook points at another slug, warn that installation will repoint it and confirm that effect.
18
+ 5. After explicit confirmation, run `arcs hooks install-claude-code <slug> --write --json` once.
19
+ 6. Report `settingsPath`, events, and next-session requirement.
15
20
 
16
- ## Flow
21
+ Do not hand-edit Claude settings. A malformed settings file is a stop condition: surface the CLI error and do not repair, reformat, or delete it. Do not rerun installation for reassurance because it may rotate the token.
17
22
 
18
- ```mermaid
19
- flowchart TD
20
- classDef decision fill:#f59e0b,color:#fff
21
- classDef terminal fill:#22c55e,color:#fff
22
-
23
- A{Running as Claude Code?}:::decision -->|no| Stop[State Claude-Code-only, stop]:::terminal
24
- A -->|yes| B[arcs hooks status slug --json]
25
- B --> C{installed?}:::decision
26
- C -->|false| D[Explain the bridge, ask to install]
27
- C -->|true| E{matchesCurrentSlug?}:::decision
28
- E -->|true| F[Report found, no-op]:::terminal
29
- E -->|false| G[Warn: installing repoints matchedSlugs, re-confirm]
30
- D -->|declines| H[Print manual fallback, no mutation]:::terminal
31
- G -->|declines| H
32
- D -->|explicit yes| I[arcs hooks install-claude-code slug --write]
33
- G -->|explicit yes| I
34
- I --> J{ok?}:::decision
35
- J -->|true| K[Report settingsPath + events + new-session note]:::terminal
36
- J -->|false| L[Surface the CLI error verbatim, no repair]:::terminal
37
- ```
38
-
39
- ## CLI Primer
40
-
41
- ```bash
42
- arcs hooks status <slug> --json
43
- arcs hooks install-claude-code <slug> --write --json
44
- ```
45
- Discovery: `arcs --commands --json`. Mutating commands run directly — no token.
46
-
47
- `hooks status` is read-only and rotates nothing, so it is safe to call as many times as you like. Its envelope:
48
-
49
- | Field | Meaning |
50
- |---|---|
51
- | `installed` | `true` only when ALL THREE events (`SessionStart`, `UserPromptSubmit`, `SessionEnd`) are registered. A partial registration is a broken bridge and reports `false`. |
52
- | `matchesCurrentSlug` | The registered hook carries `ARCS_HOOK_SLUG=<slug>` for the project you asked about. |
53
- | `matchedSlugs` | Every slug found on a matching hook command — how you see a hook wired to a *different* project. |
54
- | `hookScriptPath` | Absolute path of the script the hook entry runs; the key both status and install match on. |
55
-
56
- `hooks install-claude-code <slug> --write` performs the write via the same consent-gated merge `arcs project init` uses, and returns `settingsPath` and `events` alongside the pre-existing `token` / `hookScriptPath` / `serverUrl` / `settingsSnippet` fields. Omitting `--write` keeps the old snippet-only behavior — no file is touched — which is the manual fallback.
57
-
58
- ## Constraints
59
-
60
- - Step 0 first: not Claude Code → state that this skill is Claude-Code-only and stop. No install, no status call.
61
- - Never write without EXPLICIT user confirmation. Default posture is do nothing; silence, ambiguity, or "sure, whatever you think" is not consent.
62
- - `matchesCurrentSlug: false` with a non-empty `matchedSlugs` demands a SECOND, explicit re-confirmation — the merge is keyed on `hookScriptPath`, so one workspace holds one hook and installing silently repoints it away from the other slug.
63
- - Never edit `.claude/settings.local.json`, `.claude/settings.json`, or `~/.claude/settings.json` yourself. `--write` is the only sanctioned mutation path.
64
- - Install failure (malformed existing settings file) → surface the CLI's own error message verbatim. Do NOT repair, reformat, or delete the settings file from this skill; the CLI aborted precisely so a hand-edited file is not clobbered.
65
- - Do not rerun `--write` "to be safe" — every run rotates the token and invalidates the previously installed entry.
66
- - Pass `--url` only when the user runs `arcs web` on a non-default port; the hook posts to `http://127.0.0.1:4173` otherwise.
67
-
68
- ## Opt-In Copy (what the user must be told before confirming)
69
-
70
- State all four, plainly, before asking:
71
-
72
- 1. **What it buys them** — the ARCS web UI can see this Claude Code session, and messages queued from the UI are delivered to the next prompt.
73
- 2. **What is written** — `<workspacePath>/.claude/settings.local.json` and nothing else. Never the global config, never a committed file; `settings.local.json` is the git-ignored variant and the token in it is a secret.
74
- 3. **What is registered** — one script under three events: `SessionStart`, `UserPromptSubmit`, `SessionEnd`.
75
- 4. **When it takes effect** — a NEW Claude Code session. The session asking for the install will not pick it up.
76
-
77
- ## Worked Example
78
-
79
- ```bash
80
- # 0. Self-check: you are Claude Code. If not → "This skill is Claude-Code-only." Stop here.
81
-
82
- # 1. Read-only detection (rotates nothing; safe to repeat)
83
- arcs hooks status arcs --json
84
- # → {"installed":false,"matchesCurrentSlug":false,"matchedSlugs":[],
85
- # "hookScriptPath":"/…/scripts/claude-code-session-hook.mjs"}
86
-
87
- # 2. Not installed → present the opt-in copy above, then ask:
88
- # "Install the Claude Code session-bridge hook for `arcs` now?"
89
- # Wait for an explicit yes. Anything else → step 4.
90
-
91
- # 3. Explicit yes → install and report
92
- arcs hooks install-claude-code arcs --write --json
93
- # → {"settingsPath":"/home/u/Work/arcs/.claude/settings.local.json",
94
- # "events":["SessionStart","UserPromptSubmit","SessionEnd"], …}
95
- # Report: settingsPath, the three events, and "start a NEW Claude Code session to pick it up".
96
-
97
- # 4. Declined → no mutation. Print the manual fallback (snippet only, writes nothing):
98
- arcs hooks install-claude-code arcs --json
99
- # Paste `settingsSnippet` into .claude/settings.local.json by hand.
100
- ```
101
-
102
- Already-installed branch:
103
-
104
- ```bash
105
- arcs hooks status arcs --json
106
- # → {"installed":true,"matchesCurrentSlug":true,"matchedSlugs":["arcs"], …}
107
- # Report "session-bridge hook already installed for `arcs`". No-op. Done.
108
- ```
109
-
110
- Different-slug branch:
111
-
112
- ```bash
113
- arcs hooks status arcs --json
114
- # → {"installed":true,"matchesCurrentSlug":false,"matchedSlugs":["legacy-app"], …}
115
- # Warn: "This workspace's hook is registered for `legacy-app`. One workspace holds
116
- # one hook by design — installing for `arcs` will silently repoint it and
117
- # `legacy-app` will stop reporting sessions."
118
- # Require a SECOND explicit confirmation, then:
119
- arcs hooks install-claude-code arcs --write --json
120
- ```
121
-
122
- Failure branch:
123
-
124
- ```bash
125
- arcs hooks install-claude-code arcs --write --json
126
- # → {"ok":false,"code":"hook_install_error","message":"/…/.claude/settings.local.json exists
127
- # but is not valid JSON — fix it manually or delete it, then re-run
128
- # `arcs hooks install-claude-code arcs`. Nothing was written."}
129
- # Relay that message verbatim. Do not touch the file.
130
- ```
131
-
132
- ## Exit Conditions
133
-
134
- | Condition | Action |
135
- |-----------|--------|
136
- | Not running as Claude Code | Stop. State the skill is Claude-Code-only; run nothing |
137
- | `installed: true` and `matchesCurrentSlug: true` | Stop. Report already installed; no-op |
138
- | `installed: true` and `matchesCurrentSlug: false` | Warn that installing repoints the hook away from `matchedSlugs`; require a second explicit confirmation before `--write` |
139
- | `installed: false` | Present the opt-in copy; install only on explicit confirmation |
140
- | User declines at any confirmation | Stop. No mutation. Print the manual fallback: `arcs hooks install-claude-code <slug> --json` (snippet only, no `--write`) |
141
- | `--write` succeeds | Report `settingsPath` and `events`; tell the user a NEW Claude Code session is required |
142
- | `--write` fails (e.g. malformed settings file) | Surface the CLI's error message verbatim. Attempt no repair; nothing was written |
143
- | Project has no workspace path (`no_workspace_paths`) | Stop. Relay the error and offer the snippet-only fallback |
23
+ Without confirmation, offer the snippet-only command without `--write`.
@@ -1,162 +1,23 @@
1
1
  ---
2
2
  name: systematic-debugging
3
- description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
3
+ description: Diagnose bugs and failing tests from evidence before changing code
4
4
  ---
5
5
 
6
- # Skill: systematic-debugging
6
+ # Systematic Debugging
7
7
 
8
- ## When
8
+ ## Method
9
9
 
10
- Any bug, test failure, or unexpected behavior before proposing fixes.
10
+ Observe reproduce isolate regression test fix → verify.
11
11
 
12
- > Follows ARCS CLI Primer: `arcs --commands --json` for discovery, `--json --lean` on all calls.
12
+ 1. **Observe:** read the full error, logs, inputs, and recent relevant changes.
13
+ 2. **Reproduce:** find the smallest reliable reproduction. Add instrumentation when needed.
14
+ 3. **Isolate:** trace backward, compare a working path, and test one hypothesis at a time.
15
+ 4. **Regression test:** encode the failure when practical.
16
+ 5. **Fix:** change the root cause with the smallest targeted patch.
17
+ 6. **Verify:** show the reproduction and relevant checks pass.
13
18
 
14
- ## Flow
19
+ If three failed fixes do not improve the evidence, stop and question the architecture or assumptions instead of stacking another guess.
15
20
 
16
- ```mermaid
17
- flowchart TD
18
- classDef decision fill:#f59e0b,color:#fff
19
- classDef stop fill:#ef4444,color:#fff
21
+ Use ARCS knowledge only when a prior gotcha may save time. Capturing a durable discovery is optional, not part of the success condition.
20
22
 
21
- Bug[Bug observed] --> ARCS[Check ARCS knowledge]
22
- ARCS --> Found{Match found?}
23
- Found -->|Yes| Verify[Verify it applies]
24
- Found -->|No| Observe
25
-
26
- Verify -->|Applies| Isolate
27
- Verify -->|Doesn't apply| Observe
28
-
29
- Observe[Phase 1: Observe] --> Repro{Reproducible?}
30
- Repro -->|No| Instrument[Add logging/tracing]
31
- Instrument --> Observe
32
- Repro -->|Yes| Hypothesize[Phase 2: Hypothesize]
33
-
34
- Hypothesize --> Compare[Find working example, list differences]
35
- Compare --> Theory[Form single specific hypothesis]
36
-
37
- Theory --> Isolate[Phase 3: Isolate]
38
- Isolate --> Test{Root cause isolated?}
39
- Test -->|Yes| WriteFail[Write failing regression test]
40
- Test -->|No| FailCount{3+ failures?}
41
- FailCount -->|No| Theory
42
- FailCount -->|Yes| Arch[Question architecture]
43
-
44
- WriteFail --> Implement[Single targeted fix]
45
- Implement --> Green{Scoped verification passes?}
46
- Green -->|Yes| Capture[Propose resolution as ARCS knowledge]
47
- Green -->|No| FailCount
48
-
49
- class Found,Repro,Test,FailCount,Green decision
50
- class Arch stop
51
- ```
52
-
53
- ## Phase 1: Observe (Root Cause Investigation)
54
-
55
- - Read the actual error message completely
56
- - Reproduce consistently before proceeding
57
- - Check recent changes (`git log`, `git diff`)
58
- - Trace data flow backward from failure point
59
- - Instrument component boundaries if cause unclear
60
- - **Pre-step:** `arcs knowledge search <slug> "<error>" --json` for gotcha/lesson/pattern entries
61
-
62
- ## Phase 2: Hypothesize (Pattern Analysis)
63
-
64
- - Find a working example in the same codebase
65
- - Compare working vs broken — list every difference
66
- - Understand the dependency chain
67
- - Form ONE specific hypothesis (not multiple)
68
-
69
- ## Phase 3: Root Cause Isolation
70
-
71
- - Test the hypothesis with the smallest possible diagnostic change
72
- - One variable at a time — never stack fixes
73
- - If hypothesis fails, form a new one from evidence
74
- - Do not proceed until the evidence isolates the root cause
75
- - **Escalation:** 3+ failed fixes → question the architecture, not the symptom
76
-
77
- ## Phase 4: Fix
78
-
79
- - Write a failing regression test FIRST (proves the bug exists and prevents a fix-before-test path)
80
- - Implement a single targeted fix
81
- - Run scoped verification for the files you changed (your dispatch VERIFY command — never the full suite; the devil-advocate completion gate owns that)
82
- - Prepare the resolution as an ARCS knowledge proposal after verification passes; do not execute `arcs knowledge upsert`
83
- - If your fix introduces new failures in YOUR scoped tests, revert and return to Phase 2. Failures in files outside your scope are report-only (BLOCKED_BY) — likely a sibling agent's in-flight work; never fix or revert it
84
-
85
- ## Log Triage Protocol
86
-
87
- **Scan order:** failure point → errors → warnings → timing anomalies
88
-
89
- ```bash
90
- rg -n "ERROR|FATAL|panic|exception" <logfile> # Error grep
91
- jq 'select(.level == "error")' <json-log> # Structured logs
92
- ```
93
-
94
- **Output:** Timeline of events leading to failure (T-5m, T-3m, T-0).
95
-
96
- ## Git Bisect (Regressions)
97
-
98
- ```bash
99
- git bisect start
100
- git bisect bad HEAD
101
- git bisect good <last-known-good>
102
- git bisect run <test-command>
103
- ```
104
-
105
- After finding the commit: read the diff, isolate specific lines, feed into Phase 2.
106
-
107
- ## Dependency Conflict Diagnosis
108
-
109
- | Symptom | Likely Cause |
110
- |---------|-------------|
111
- | `instanceof` fails across modules | Duplicate package copies |
112
- | Type mismatch on same interface | Different versions loaded |
113
- | "Cannot find module" intermittent | Hoisting conflict |
114
- | Works with `--legacy-peer-deps` | Peer dep unsatisfied |
115
-
116
- Diagnose: `npm ls <pkg>`, `npm explain <pkg>`, check for multiple copies.
117
-
118
- ## ARCS Knowledge Capture
119
-
120
- After root cause identification, propose durable knowledge for orchestrator fan-in persistence:
121
- - **gotcha** — environmental/config traps
122
- - **lesson** — architectural insights from this session
123
- - **pattern** — reusable solution to recurring problem
124
-
125
- Include: root cause summary, evidence, affected files, fix approach.
126
-
127
- ### Propose Resolution as Knowledge
128
-
129
- After resolving the issue, choose the kind and obtain its required anatomy before authoring a complete entry:
130
-
131
- ```bash
132
- arcs knowledge template --kind=gotcha --json
133
- # Fill every returned section with observed evidence, affected files, and the fix approach.
134
- arcs knowledge upsert <slug> "<specific debugging discovery>" \
135
- --kind=gotcha --summary="<durable takeaway>" --body-file=<complete-body.md> \
136
- --keywords="<error,component,root-cause>" --source-files=<affected-paths> --json
137
- ```
138
-
139
- Return that command as a ready-to-run proposal. Do not execute `arcs knowledge upsert`; the orchestrator owns fan-in persistence. Use the same template-first flow for `lesson` and `pattern`; do not copy a body-shaped example that omits the selected kind's required sections.
140
-
141
- **Kind selection guide:**
142
- - `gotcha` — surprising behavior, trap, or non-obvious failure mode
143
- - `lesson` — learned technique, debugging approach, resolution method
144
- - `pattern` — reusable solution that should be applied going forward
145
-
146
- ## Constraints
147
-
148
- - **NO FIXES WITHOUT ROOT CAUSE INVESTIGATION.** If Phase 1 incomplete, you cannot propose fixes.
149
- - **One variable at a time.** Never apply multiple changes simultaneously.
150
- - **3+ failures = architectural problem.** Stop fixing symptoms, question the pattern.
151
- - **Test before fix.** Failing test proves the bug; green test proves the fix.
152
- - **Defense in depth:** After fixing root cause, add validation at multiple layers to prevent recurrence.
153
- - **Systematic is faster than thrashing.** 15-30min systematic vs 2-3h random fixes.
154
-
155
- ## Red Flags (Return to Phase 1)
156
-
157
- - "Quick fix for now, investigate later"
158
- - "Just try changing X and see"
159
- - Proposing solutions before tracing data flow
160
- - Each fix reveals a new problem in a different place
161
- - "I don't fully understand but this might work"
162
- - Human says "stop guessing" or "is that not happening?"
23
+ Optional references provide concise techniques for tracing, waiting, and defense in depth. Do not run destructive Git operations unless the user requests them.