@rryando/arcs 3.3.2 → 3.4.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 (67) hide show
  1. package/README.md +17 -14
  2. package/dist/cli/arcs-orchestrate.d.ts +1 -1
  3. package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
  4. package/dist/cli/arcs-orchestrate.js +5 -3
  5. package/dist/cli/arcs-orchestrate.js.map +1 -1
  6. package/dist/cli/bundle-installer.d.ts.map +1 -1
  7. package/dist/cli/bundle-installer.js +32 -0
  8. package/dist/cli/bundle-installer.js.map +1 -1
  9. package/dist/cli/commands/maintenance.js +26 -24
  10. package/dist/cli/commands/maintenance.js.map +1 -1
  11. package/dist/cli/commands/project.js +49 -26
  12. package/dist/cli/commands/project.js.map +1 -1
  13. package/dist/cli/commands/proposal.js +12 -11
  14. package/dist/cli/commands/proposal.js.map +1 -1
  15. package/dist/cli/config.d.ts +19 -0
  16. package/dist/cli/config.d.ts.map +1 -1
  17. package/dist/cli/config.js +23 -0
  18. package/dist/cli/config.js.map +1 -1
  19. package/dist/cli/instructions.d.ts.map +1 -1
  20. package/dist/cli/instructions.js +14 -0
  21. package/dist/cli/instructions.js.map +1 -1
  22. package/dist/cli/setup.d.ts +6 -3
  23. package/dist/cli/setup.d.ts.map +1 -1
  24. package/dist/cli/setup.js +125 -70
  25. package/dist/cli/setup.js.map +1 -1
  26. package/dist/utils/codegraph-install.d.ts +16 -0
  27. package/dist/utils/codegraph-install.d.ts.map +1 -0
  28. package/dist/utils/codegraph-install.js +81 -0
  29. package/dist/utils/codegraph-install.js.map +1 -0
  30. package/dist/utils/codegraph-knowledge.d.ts +22 -0
  31. package/dist/utils/codegraph-knowledge.d.ts.map +1 -0
  32. package/dist/utils/codegraph-knowledge.js +47 -0
  33. package/dist/utils/codegraph-knowledge.js.map +1 -0
  34. package/dist/utils/codegraph.d.ts +101 -0
  35. package/dist/utils/codegraph.d.ts.map +1 -0
  36. package/dist/utils/codegraph.js +383 -0
  37. package/dist/utils/codegraph.js.map +1 -0
  38. package/dist/utils/json-schemas.d.ts +84 -84
  39. package/dist/utils/json-schemas.d.ts.map +1 -1
  40. package/dist/utils/json-schemas.js +11 -9
  41. package/dist/utils/json-schemas.js.map +1 -1
  42. package/dist/utils/proposal-store.d.ts +2 -2
  43. package/dist/utils/proposal-store.d.ts.map +1 -1
  44. package/dist/utils/proposal-store.js +34 -7
  45. package/dist/utils/proposal-store.js.map +1 -1
  46. package/opencode/arcs/bundle-runtime.json +2 -2
  47. package/opencode/arcs/manifest.json +1 -1
  48. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +5 -3
  49. package/opencode/arcs/prompts/arcs-orchestrate.txt +5 -3
  50. package/opencode/arcs/prompts/code-reviewer.txt +2 -0
  51. package/opencode/arcs/prompts/docs-researcher.txt +1 -1
  52. package/opencode/arcs/prompts/graph-explorer.txt +36 -202
  53. package/opencode/arcs/prompts/oncall-ops.txt +2 -0
  54. package/opencode/arcs/prompts/system-architect.txt +2 -0
  55. package/opencode/arcs/prompts/tech-architect.txt +2 -0
  56. package/opencode/arcs/skills/deep-pr-review/SKILL.md +5 -5
  57. package/opencode/arcs/skills/deep-pr-review/{graphify-diff.md → codegraph-diff.md} +27 -31
  58. package/opencode/arcs/skills/deep-pr-review/review-template.md +2 -2
  59. package/opencode/arcs/skills/{enriching-graphify-proposals → enriching-codegraph-proposals}/SKILL.md +8 -8
  60. package/opencode/arcs/skills/init-project/SKILL.md +38 -38
  61. package/package.json +2 -2
  62. package/scripts/build-opencode-bundle.mjs +4 -3
  63. package/scripts/deploy-claudecode-bundle.mjs +8 -1
  64. package/scripts/deploy-opencode-bundle.mjs +8 -1
  65. package/scripts/lib/bundle-helpers.mjs +17 -0
  66. package/scripts/lint-bundle.mjs +5 -2
  67. package/skills/init-project.md +25 -25
@@ -1,19 +1,21 @@
1
- # Graphify Diff Algorithm
1
+ # Codegraph Diff Algorithm
2
2
 
3
- `graphify` has no native "diff against PR" command. This file defines how `deep-pr-review` builds coupling/duplication checks on top of the existing `affected`, `query`, and `diagnose multigraph` primitives.
3
+ `codegraph` has no native "diff against PR" command. This file defines how `deep-pr-review` builds coupling/duplication checks on top of the existing `impact`, `callers`/`callees`, and `query` primitives.
4
4
 
5
5
  ## Prerequisites
6
6
 
7
7
  ```bash
8
- which graphify || echo "skip" # graceful absence
9
- ls graphify-out/graph.json 2>/dev/null # graph must exist
8
+ which codegraph || echo "skip" # graceful absence
9
+ codegraph status --json 2>/dev/null # index must exist + be initialized
10
10
  ```
11
11
 
12
- If graphify is missing or `graph.json` is older than the PR's base commit, refresh:
12
+ If codegraph is missing or the index is stale relative to the PR's base commit, refresh:
13
13
  ```bash
14
- graphify update .
14
+ codegraph sync . # incremental; or `codegraph index . --force` for a full rebuild
15
15
  ```
16
16
 
17
+ The index lives in `.codegraph/` (SQLite, gitignored) — there is no `graph.json` file.
18
+
17
19
  ## Step 1: Extract changed symbols from the diff
18
20
 
19
21
  ```bash
@@ -22,7 +24,7 @@ gh pr diff <num> --patch > /tmp/pr.diff
22
24
 
23
25
  Parse `/tmp/pr.diff` to extract changed symbols:
24
26
  - For each `+++ b/<file>` hunk, capture the file path
25
- - For each added / modified function or exported identifier, capture `<file>::<symbol>`
27
+ - For each added / modified function or exported identifier, capture `<symbol>` (codegraph addresses symbols by name, not `<file>::<symbol>`)
26
28
  - Skip pure deletions (handled separately under "removed coupling" check)
27
29
 
28
30
  Heuristic for symbol extraction (language-aware):
@@ -32,16 +34,19 @@ Heuristic for symbol extraction (language-aware):
32
34
  - Rust: `fn X`, `struct X`, `impl X`
33
35
  - Other: fall back to file-level granularity
34
36
 
35
- ## Step 2: Run `affected` per changed symbol
37
+ ## Step 2: Run `impact` per changed symbol
36
38
 
37
39
  ```bash
38
- graphify affected "<file>::<symbol>" --depth 2 --json
40
+ codegraph impact "<symbol>" --json # what code is affected by changing this symbol
41
+ codegraph callers "<symbol>" --json # direct callers (one hop)
39
42
  ```
40
43
 
44
+ `codegraph impact` is the closest equivalent to the old `affected --depth N`: it walks the reverse-dependency closure for a symbol. Use `callers` for a precise one-hop view when `impact` is too broad.
45
+
41
46
  Collect for each symbol:
42
- - **Fan-out callers** — who depends on this symbol (changes ripple here)
43
- - **Fan-out depth** — how many hops to leaves
44
- - **Cross-module edges** — callers in different top-level dirs
47
+ - **Fan-out callers** — who depends on this symbol (changes ripple here), from `callers` / `impact`
48
+ - **Fan-out reach** — size of the impact set (proxy for blast radius)
49
+ - **Cross-module edges** — callers in different top-level dirs (derive from each caller's `file_path`)
45
50
 
46
51
  ## Step 3: Detect surprising fan-out
47
52
 
@@ -57,23 +62,15 @@ Flag as 🟠 **risk** in the report when:
57
62
 
58
63
  For each new function added in the diff, run:
59
64
  ```bash
60
- graphify query "functions similar to <new-symbol-signature>" --budget 8 --json
61
- ```
62
-
63
- If results include symbols with similar signatures (≥70% name overlap or matching parameter shape), flag as 🟡 **suggestion** with citation `graphify: similar to <existing-symbol>` and propose extraction or reuse.
64
-
65
- ## Step 5: Diagnose multigraph (architectural drift)
66
-
67
- ```bash
68
- graphify diagnose multigraph --json
65
+ codegraph query "<new-symbol-name or signature keywords>" --json
69
66
  ```
70
67
 
71
- If the PR introduces edges that contribute to a multigraph collapse (multiple edges between the same node pair), flag as 🟠 **risk** with handoff to `architecture-review`. Same-endpoint multi-edges are a structural duplication signal worth surfacing but not worth diagnosing inline.
68
+ `codegraph query` is a symbol search over the index. If results include symbols with similar names/signatures (≥70% name overlap or matching parameter shape), flag as 🟡 **suggestion** with citation `codegraph: similar to <existing-symbol>` and propose extraction or reuse.
72
69
 
73
- ## Step 6: Aggregate findings
70
+ ## Step 5: Aggregate findings
74
71
 
75
- Each graphify-derived finding must include:
76
- - The `graphify` command that produced it (for reproducibility)
72
+ Each codegraph-derived finding must include:
73
+ - The `codegraph` command that produced it (for reproducibility)
77
74
  - The cited symbol(s) — use backticks
78
75
  - The cited module path(s)
79
76
  - A finding ID for re-review tracking: `<file>:<line>:<dimension>:<short-hash>`
@@ -84,19 +81,18 @@ Each graphify-derived finding must include:
84
81
  - All exported / public symbols first (always)
85
82
  - Then internal symbols by descending hunk size
86
83
  - Skip step 4 (duplication) entirely if diff size exceeds 1500 LOC — too noisy
87
- - Skip step 5 (multigraph) if `graphify diagnose multigraph` runtime exceeds 10s — log and continue without
88
84
 
89
85
  ## Graceful degradation
90
86
 
91
- If any graphify call fails or returns empty:
92
- - Note in report: `Graphify step <N> unavailable: <reason>` under "Cleared Dimensions"
87
+ If any codegraph call fails or returns empty:
88
+ - Note in report: `Codegraph step <N> unavailable: <reason>` under "Cleared Dimensions"
93
89
  - Continue with the remaining dimensions
94
- - Never let a graphify failure abort the review
90
+ - Never let a codegraph failure abort the review
95
91
 
96
92
  ## Output integration
97
93
 
98
- Graphify findings flow back into the standard finding pipeline. Each one is:
99
- - Cited as `graphify: <one-line observation>`
94
+ Codegraph findings flow back into the standard finding pipeline. Each one is:
95
+ - Cited as `codegraph: <one-line observation>`
100
96
  - Severity-classified (most are 🟡 suggestion or 🟠 risk; rarely 🔴)
101
97
  - Attached to a specific file+line if possible; otherwise lives in the top-level review body
102
98
  - Tagged for re-review with `<!-- arcs:deep-review:<finding-id> -->`
@@ -31,7 +31,7 @@ Used as the `body` field of `gh api repos/{owner}/{repo}/pulls/{pull_number}/rev
31
31
  ### Citations Used
32
32
  - AGENTS.md §<section> — <what was checked>
33
33
  - knowledge/<id> — <what was checked>
34
- - graphify — <observations, if run>
34
+ - codegraph — <observations, if run>
35
35
 
36
36
  ---
37
37
  <!-- arcs:deep-review:meta version=1 commit=<HEAD_SHA> rubric=<activated> mode=<posting-mode> -->
@@ -51,7 +51,7 @@ Used as the `body` field of `gh api repos/{owner}/{repo}/pulls/{pull_number}/rev
51
51
 
52
52
  <optional 1-2 sentences of why, only if not obvious from problem>
53
53
 
54
- Citation: <AGENTS.md §x | knowledge/<id> | graphify | principle: <name>>
54
+ Citation: <AGENTS.md §x | knowledge/<id> | codegraph | principle: <name>>
55
55
 
56
56
  ​```suggestion
57
57
  <replacement code — only for small line replacements>
@@ -1,17 +1,17 @@
1
1
  ---
2
- name: enriching-graphify-proposals
3
- description: Use when `arcs project init` or `arcs graphify-sync` returns `pending_enrichment: true` — drives the per-proposal verdict loop (keep/drop/merge) and produces agent-authored knowledge entries from raw graphify proposals.
2
+ name: enriching-codegraph-proposals
3
+ description: Use when `arcs project init` or `arcs codegraph-sync` returns `pending_enrichment: true` — drives the per-proposal verdict loop (keep/drop/merge) and produces agent-authored knowledge entries from raw codegraph proposals.
4
4
  ---
5
5
 
6
- # Skill: enriching-graphify-proposals
6
+ # Skill: enriching-codegraph-proposals
7
7
 
8
8
  ## When
9
9
 
10
- The CLI surfaced raw graphify proposals and is waiting for an agent to turn them into real knowledge entries. Mandatory triggers:
10
+ The CLI surfaced raw codegraph proposals and is waiting for an agent to turn them into real knowledge entries. Mandatory triggers:
11
11
 
12
- - `arcs project init` returned `graphify.pending_enrichment: true` in its JSON envelope.
13
- - `arcs graphify-sync` returned `pending_enrichment: true`.
14
- - User said "enrich the proposals", "process the graphify queue", "promote the pending proposals", or similar.
12
+ - `arcs project init` returned `codegraph.pending_enrichment: true` in its JSON envelope.
13
+ - `arcs codegraph-sync` returned `pending_enrichment: true`.
14
+ - User said "enrich the proposals", "process the codegraph queue", "promote the pending proposals", or similar.
15
15
 
16
16
  > **Read-write skill.** This skill mutates the DAG via `arcs proposal promote/drop`. Self-score ≥80% via `confidence-gate` before each promote.
17
17
 
@@ -75,7 +75,7 @@ Use `arcs proposal promote --merge-with=<existing-id>` when:
75
75
  - `suggestedDedupCandidates` lists an existing knowledge entry whose `kind` matches the proposal's natural kind, AND
76
76
  - The proposal adds genuinely new structural facts the existing entry does not already document (e.g. precise degree numbers, additional top hubs, cross-module edges, fileCount).
77
77
 
78
- The agent appends a `## From graphify analysis` section to the existing entry — it does NOT replace prior body content. Treat the existing entry as the spine; the merge adds a graph-evidence rib.
78
+ The agent appends a `## From codegraph analysis` section to the existing entry — it does NOT replace prior body content. Treat the existing entry as the spine; the merge adds a graph-evidence rib.
79
79
 
80
80
  ## Enrichment Output Contract
81
81
 
@@ -1,6 +1,6 @@
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 → graphify ingestion → fan-out analysis across typed sub-agents.
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.
4
4
  ---
5
5
 
6
6
  # Skill: init-project
@@ -21,11 +21,11 @@ flowchart TD
21
21
  B --> C[Present summary to user]
22
22
  C -->|user confirms| D[arcs project init]
23
23
  D --> E[arcs project update-doc × 4]
24
- E --> F{graphify on PATH?}
25
- F -->|yes| G[graphify update --force --no-cluster]
24
+ E --> F{codegraph on PATH?}
25
+ F -->|yes| G[codegraph index --force --quiet]
26
26
  F -->|no| H[Skip graph step, log gap]
27
27
  G --> G2[ingestGraph → ≤20 proposals]
28
- G2 --> G3[graphify query / explain for enrichment]:::sub
28
+ G2 --> G3[codegraph MCP explore / impact for enrichment]:::sub
29
29
  H & G3 --> I[Fan out: system-architect + docs-researcher + tech-architect]:::sub
30
30
  I --> J[Collect proposals → dedup → arcs knowledge create × N]
31
31
  J --> K[Done]
@@ -44,33 +44,33 @@ Discovery: `arcs --commands --json`. Mutating commands run directly — no token
44
44
  - Verify `dependsOn` targets exist via `arcs project list --json`
45
45
  - `arcs project init` creates empty `plans/`, `knowledge/`, `tasks/` indexes — don't pre-populate
46
46
  - Repo analysis is **fan-out across typed agents**, never a generic "analysis sub-agent" (see Agent Dispatch below)
47
- - Never block INIT on graphify — it's optional. Skip cleanly if missing.
47
+ - Never block INIT on codegraph — it's optional. Skip cleanly if missing.
48
48
 
49
- ## Graphify Sub-Flow (DEFAULT: ON when binary present)
49
+ ## Codegraph Sub-Flow (DEFAULT: ON when binary present)
50
50
 
51
- The orchestrator runs graphify 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-graphify-proposals` skill. This is the default path when `graphify` is on PATH; skip cleanly otherwise.
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
52
 
53
- 1. **Detect:** call `detectGraphify()` from `src/utils/graphify.ts`. If unavailable, log "graphify not on PATH; proceeding without graph signal" and skip steps 3–6.
54
- 2. **Trust the gitignore guarantee:** `runExtraction()` already auto-appends `graphify-out/` to `.gitignore` via `ensureGitignoreEntry`. Do NOT redundantly check or modify `.gitignore` from agents — running extraction is sufficient.
55
- 3. **Extract** (AST-only, no LLM API key required):
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
56
  ```bash
57
- graphify update <workspacePath> --force --no-cluster
57
+ codegraph index <workspacePath> --force --quiet
58
58
  ```
59
- Produces `<workspacePath>/graphify-out/graph.json`.
60
- 4. **Ingest as proposals:** `arcs project init` internally calls `ingestGraph(graphJsonPath, slug)`, which writes up to 20 structural proposals to `proposals/graphify.json` (test files filtered):
61
- - 8 god nodes (`kind=module`, top 5% degree)
62
- - 8 architecture clusters (`kind=architecture`, by community or directory grouping)
63
- - 5 cross-module couplings (`kind=gotcha`, high-degree links across top-level dirs)
64
-
65
- Graphify never writes directly to the knowledge surface. The init envelope returns `data.graphify.pending_enrichment: true` to signal that proposals are waiting.
66
- 5. **Enrich** with the `enriching-graphify-proposals` skill — read `arcs proposal list <slug> --json`, decide per-proposal verdicts (keep / merge / drop), persist via `arcs proposal promote` and `arcs proposal drop`. The skill encodes the decision heuristics, output contract, and cost discipline; do not paraphrase.
67
- 6. **Optional graph queries** for evidence during enrichment (sub-agents may run these):
68
- - `graphify query "entry points and main commands" --graph graphify-out/graph.json --budget 2000` → seeds for "key files" reference entries
69
- - `graphify query "core data flow" --graph graphify-out/graph.json --budget 2000` → seeds for "core modules" entries
70
- - `graphify explain "<godNodeLabel>" --graph graphify-out/graph.json` → plain-language summary for module entry bodies
71
- - `graphify affected "<critical-symbol>" --graph graphify-out/graph.json --depth 2` → reverse-impact map for high-risk modules
72
- - `graphify path "<A>" "<B>" --graph graphify-out/graph.json` → shortest dependency path for architecture entries
73
- 7. **Hand to typed agents** (in parallel) for code-grounded follow-up entries that go beyond what graphify proposals cover — see **Agent Dispatch** below.
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), persist via `arcs proposal promote` and `arcs proposal drop`. The skill encodes the decision heuristics, output contract, and cost discipline; do not paraphrase.
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 code-grounded follow-up entries that go beyond what codegraph proposals cover — see **Agent Dispatch** below.
74
74
 
75
75
  ## Content Guidelines
76
76
 
@@ -93,8 +93,8 @@ Update via `arcs project update-doc <slug> <doc> --content="..."`.
93
93
  | `qa-analyst` (optional) | Coding-style + convention scan from existing code | `pattern` |
94
94
 
95
95
  Dispatch in parallel — load `dispatching-parallel-agents`. Each agent receives:
96
- - The relevant `KnowledgeProposal` records from `ingestGraph` (so they don't rediscover what graphify already found)
97
- - Targeted graphify queries for evidence (e.g., `graphify explain` output for the modules they own)
96
+ - The relevant `KnowledgeProposal` records from `ingestGraph` (so they don't rediscover what codegraph already found)
97
+ - Targeted codegraph queries for evidence (e.g., `codegraph_node` / `codegraph_impact` output for the modules they own)
98
98
  - Explicit scope (which files / which kinds to produce)
99
99
 
100
100
  Each agent returns finalized proposals: `{title, kind, summary, keywords, sourceFiles, body}`. The orchestrator dedups, then writes the entries directly via `arcs knowledge create` (or `arcs batch`).
@@ -104,15 +104,15 @@ Each agent returns finalized proposals: `{title, kind, summary, keywords, source
104
104
  | Category | Kind | What to discover | Primary agent |
105
105
  |----------|------|------------------|---------------|
106
106
  | tech stack | `architecture` | Languages, frameworks, runtimes, build tools, versions | `docs-researcher` |
107
- | key files | `reference` | Entry points, config files, main modules, purposes | `docs-researcher` (use `graphify query "entry points"`) |
107
+ | key files | `reference` | Entry points, config files, main modules, purposes | `docs-researcher` (use `codegraph_search "entry points"`) |
108
108
  | code patterns | `pattern` | Recurring design patterns, abstractions, error handling | `qa-analyst` or `system-architect` |
109
109
  | coding style | `pattern` | Formatting, linting, import ordering, file organization | `qa-analyst` |
110
- | core modules | `module` | Core modules / shared functions — what, where, interconnections | `system-architect` (god nodes from graphify) |
110
+ | core modules | `module` | Core modules / shared functions — what, where, interconnections | `system-architect` (god nodes from codegraph) |
111
111
  | external services | `module` | APIs, databases, message queues the project interacts with | `docs-researcher` |
112
112
  | third-party libraries | `reference` | Key dependencies and why they are used | `docs-researcher` |
113
113
  | features | `feature` | Major user-facing or system-facing features | `docs-researcher` |
114
- | cross-module couplings | `gotcha` | Hot edges between modules surfaced by graphify | `tech-architect` (auto from `ingestGraph`) |
115
- | architecture clusters | `architecture` | Community / directory groupings from graphify | `system-architect` (auto from `ingestGraph`) |
114
+ | cross-module couplings | `gotcha` | Hot edges between modules surfaced by codegraph | `tech-architect` (auto from `ingestGraph`) |
115
+ | architecture clusters | `architecture` | Pseudo-community / directory groupings from codegraph | `system-architect` (auto from `ingestGraph`) |
116
116
 
117
117
  ## Worked Example
118
118
 
@@ -127,11 +127,11 @@ arcs project init "Foo" --description="Foo CLI tool" --path="$(pwd)" --json
127
127
  arcs project update-doc foo overview --content="..." --json
128
128
  # ... repeat for tasks, dependencies, knowledge
129
129
 
130
- # 4. Graphify (if available) — runs inside `arcs project init`
131
- graphify update . --force --no-cluster
132
- # ingestGraph writes proposals to proposals/graphify.json
133
- # init envelope: data.graphify.pending_enrichment === true → load
134
- # `enriching-graphify-proposals` and run the verdict loop:
130
+ # 4. Codegraph (if available) — runs inside `arcs project init`
131
+ codegraph index . --force --quiet
132
+ # ingestGraph parses codegraph CLI --json → proposals/graphify.json (filename retained; rename pending)
133
+ # init envelope: data.codegraph.pending_enrichment === true → load
134
+ # `enriching-codegraph-proposals` and run the verdict loop:
135
135
  arcs proposal list foo --json
136
136
  arcs proposal promote foo <id> --title="..." --summary="..." --body-file=... --kind=module --source-files=... --json
137
137
  arcs proposal drop foo <id> --reason="..." --json
@@ -152,6 +152,6 @@ arcs knowledge create foo "Tech stack: TypeScript + Node 20" --kind=architecture
152
152
  |-----------|--------|
153
153
  | Project already in DAG (slug collision) | Stop. Surface conflict; ask user to rename or use existing |
154
154
  | User declines summary | Stop. No mutations performed |
155
- | `graphify` missing | Continue without graph signal; sub-agents run with code reading only |
155
+ | `codegraph` missing | Continue without graph signal; sub-agents run with code reading only |
156
156
  | `dependsOn` target missing | Stop. Ask user to init dependencies first or remove the link |
157
157
  | Init succeeds but knowledge fan-out fails | Project exists in DAG; rerun knowledge phase later via SYNC |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rryando/arcs",
3
- "version": "3.3.2",
3
+ "version": "3.4.0",
4
4
  "description": "ARCS — DAG-based task orchestration for AI agents. Persistent workflow continuity via graph-structured context.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "opencode/"
16
16
  ],
17
17
  "engines": {
18
- "node": ">=18"
18
+ "node": ">=20"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { dirname, relative, resolve } from "node:path";
3
- import { pathToFileURL } from "node:url";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
4
 
5
5
  import {
6
6
  normalizeRelativePath,
@@ -8,7 +8,8 @@ import {
8
8
  validateDeclaredPath,
9
9
  } from "./lib/bundle-helpers.mjs";
10
10
 
11
- const repoRoot = resolve(import.meta.dirname, "..");
11
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
12
+ const repoRoot = resolve(scriptDir, "..");
12
13
  const defaultManifestPath = resolve(repoRoot, "opencode/arcs/bundle-runtime.json");
13
14
  const defaultOutputRoot = resolve(repoRoot, "opencode/arcs");
14
15
  // Files that are repo-authored and must not be pruned. The repo bundle
@@ -19,7 +20,7 @@ const preservedOutputFiles = new Set([
19
20
  ".opencode/plugins/arcs.js",
20
21
  // ARCS-native skills (authored in this repo, no upstream source)
21
22
  // init-project skill — ARCS-native (mirrors orchestrator INIT workflow with
22
- // graphify sub-flow, typed-agent dispatch, knowledge categories).
23
+ // codegraph sub-flow, typed-agent dispatch, knowledge categories).
23
24
  "skills/init-project/SKILL.md",
24
25
  // Caveman commit skill — adapted from https://github.com/JuliusBrussee/caveman (MIT).
25
26
  "skills/caveman-commit/SKILL.md",
@@ -31,8 +31,11 @@ import {
31
31
  } from "node:fs";
32
32
  import { homedir } from "node:os";
33
33
  import { dirname, relative, resolve } from "node:path";
34
+ import { fileURLToPath } from "node:url";
35
+ import { wireCodegraphMcp } from "./lib/bundle-helpers.mjs";
34
36
 
35
- const repoRoot = resolve(import.meta.dirname, "..");
37
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
38
+ const repoRoot = resolve(scriptDir, "..");
36
39
  const defaultBundleRoot = resolve(repoRoot, "opencode/arcs");
37
40
  const defaultConfigRoot = resolve(homedir(), ".claude");
38
41
  const defaultProjectRoot = repoRoot;
@@ -422,6 +425,9 @@ function main() {
422
425
  }
423
426
  }
424
427
 
428
+ // Best-effort: wire the codegraph MCP server. Skipped on dry-run; never fatal.
429
+ const codegraphWired = dryRun ? false : wireCodegraphMcp("claude");
430
+
425
431
  const result = {
426
432
  dryRun,
427
433
  source: bundleRoot,
@@ -431,6 +437,7 @@ function main() {
431
437
  filesChanged,
432
438
  filesRemoved,
433
439
  filesUnchanged,
440
+ codegraphWired,
434
441
  };
435
442
 
436
443
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
@@ -23,8 +23,11 @@ import {
23
23
  } from "node:fs";
24
24
  import { homedir } from "node:os";
25
25
  import { dirname, relative, resolve } from "node:path";
26
+ import { fileURLToPath } from "node:url";
27
+ import { wireCodegraphMcp } from "./lib/bundle-helpers.mjs";
26
28
 
27
- const repoRoot = resolve(import.meta.dirname, "..");
29
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
30
+ const repoRoot = resolve(scriptDir, "..");
28
31
  const defaultBundleRoot = resolve(repoRoot, "opencode/arcs");
29
32
  const defaultConfigRoot = resolve(homedir(), ".config/opencode");
30
33
 
@@ -176,6 +179,9 @@ async function main() {
176
179
  }
177
180
  }
178
181
 
182
+ // Best-effort: wire the codegraph MCP server. Skipped on dry-run; never fatal.
183
+ const codegraphWired = dryRun ? false : wireCodegraphMcp("opencode");
184
+
179
185
  const result = {
180
186
  dryRun,
181
187
  source: bundleRoot,
@@ -186,6 +192,7 @@ async function main() {
186
192
  filesUnchanged,
187
193
  restartRequired,
188
194
  cliRegistered: !dryRun,
195
+ codegraphWired,
189
196
  ...(restartRequired && {
190
197
  restartGuidance: "Plugin file changed. Restart opencode for changes to take effect.",
191
198
  }),
@@ -1,3 +1,4 @@
1
+ import { spawnSync } from "node:child_process";
1
2
  import { isAbsolute, relative, resolve } from "node:path";
2
3
 
3
4
  export function normalizeRelativePath(filePath) {
@@ -170,3 +171,19 @@ export function validateDeclaredPath(relativePath, outputRoot, validationRoot) {
170
171
 
171
172
  return normalizedPath;
172
173
  }
174
+
175
+ export function wireCodegraphMcp(target) {
176
+ // Best-effort: wire the codegraph MCP server for this host. Non-fatal.
177
+ // Skipped silently if the codegraph binary is absent.
178
+ try {
179
+ const r = spawnSync("codegraph", ["install", `--target=${target}`, "--yes"], {
180
+ encoding: "utf-8",
181
+ stdio: ["pipe", "pipe", "pipe"],
182
+ timeout: 120_000,
183
+ });
184
+ if (r.error || r.status !== 0) return false;
185
+ return true;
186
+ } catch {
187
+ return false;
188
+ }
189
+ }
@@ -9,9 +9,12 @@
9
9
  // Exit code: 0 if no errors, 1 if errors found.
10
10
 
11
11
  import { existsSync, readdirSync, readFileSync } from "node:fs";
12
- import { relative, resolve } from "node:path";
12
+ import { dirname, relative, resolve } from "node:path";
13
+ import { fileURLToPath } from "node:url";
13
14
 
14
- const repoRoot = resolve(import.meta.dirname, "..");
15
+ // import.meta.dirname is Node >=20.11; derive it for Node 18 compatibility.
16
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
17
+ const repoRoot = resolve(scriptDir, "..");
15
18
  const defaultBundleRoot = resolve(repoRoot, "opencode/arcs");
16
19
 
17
20
  const bundleRoot = process.env.BUNDLE_LINT_BUNDLE_ROOT
@@ -19,11 +19,11 @@ flowchart TD
19
19
  B --> C[Present summary to user]
20
20
  C -->|confirmed| D[arcs project init]
21
21
  D --> E[arcs project update-doc × 4]
22
- E --> F{graphify on PATH?}
23
- F -->|yes| G[graphify update --force --no-cluster]
22
+ E --> F{codegraph on PATH?}
23
+ F -->|yes| G[codegraph index --force --quiet]
24
24
  F -->|no| H[Skip graph step, log gap]
25
25
  G --> G2[ingestGraph → ≤20 proposals]
26
- G2 --> G3[graphify query / explain for enrichment]:::sub
26
+ G2 --> G3[codegraph MCP explore / impact for enrichment]:::sub
27
27
  H & G3 --> I[Fan out: system-architect + docs-researcher + tech-architect]:::sub
28
28
  I --> J[Collect proposals → dedup → arcs knowledge create × N]
29
29
  J --> K[Done]
@@ -43,31 +43,31 @@ Discovery: `arcs --commands --json`
43
43
  - Init creates empty plans/ and knowledge/ indexes
44
44
  - Repo analysis is **fan-out across typed agents**, not a generic "analysis sub-agent" (see Agent Dispatch table below)
45
45
 
46
- ## Graphify Sub-Flow (DEFAULT: ON when binary present)
46
+ ## Codegraph Sub-Flow (DEFAULT: ON when binary present)
47
47
 
48
- The orchestrator runs graphify directly during INIT to seed knowledge entries with structural evidence before any sub-agent reads code.
48
+ The orchestrator runs codegraph directly during INIT to produce structural **proposals** before any sub-agent reads code. Proposals land on the proposal-store ledger (`pending_enrichment: true`); agents enrich them into knowledge entries via the `enriching-codegraph-proposals` skill.
49
49
 
50
- 1. **Detect:** `detectGraphify()` from `src/utils/graphify.ts`. If unavailable, skip cleanly — never block INIT on graphify.
51
- 2. **Trust the gitignore guarantee:** `runExtraction()` already auto-appends `graphify-out/` to `.gitignore` (`ensureGitignoreEntry`). Don't redundantly check or modify `.gitignore` from agents — running extraction is sufficient.
52
- 3. **Extract (AST-only, no LLM key required):**
50
+ 1. **Detect:** `detectCodegraph()` from `src/utils/codegraph.ts`. If unavailable, skip cleanly — never block INIT on codegraph.
51
+ 2. **Trust the gitignore guarantee:** `runIndex()` already auto-appends `.codegraph/` to `.gitignore` (`ensureGitignoreEntry`). Don't redundantly check or modify `.gitignore` from agents — running the index is sufficient.
52
+ 3. **Index (AST-based; CLI drives the bundled runtime, no LLM key required):**
53
53
  ```bash
54
- graphify update <workspacePath> --force --no-cluster
54
+ codegraph index <workspacePath> --force --quiet
55
55
  ```
56
- Produces `graphify-out/graph.json`.
57
- 4. **Ingest:** call internal `ingestGraph(graphJsonPath, slug)` → up to 20 `KnowledgeProposal` records:
58
- - 8 god nodes (`kind=module`, top 5% degree, test files filtered)
59
- - 8 architecture clusters (`kind=architecture`, by community or directory grouping)
56
+ Builds a per-project SQLite index under `<workspacePath>/.codegraph/`. There is no `graph.json` artifact.
57
+ 4. **Ingest:** `arcs project init` internally calls `ingestGraph(workspacePath, slug)` → up to 20 `KnowledgeProposal` records written to `proposals/graphify.json` (filename retained for compatibility; rename pending; test files filtered):
58
+ - 8 god nodes (`kind=module`, ranked by callers+callees / impact)
59
+ - 8 architecture clusters (`kind=architecture`, synthesized pseudo-communities by directory prefix)
60
60
  - 5 cross-module couplings (`kind=gotcha`, high-degree links across top-level dirs)
61
- 5. **Enrich** with read-only graph queries (sub-agents may run these):
62
- - `graphify query "entry points and main commands" --graph graphify-out/graph.json --budget 2000` → seeds for "key files" reference entries
63
- - `graphify query "core data flow" --graph graphify-out/graph.json --budget 2000` → seeds for "core modules" entries
64
- - `graphify explain "<godNodeLabel>" --graph graphify-out/graph.json` → plain-language summary for module entry bodies
65
- - `graphify affected "<critical-symbol>" --graph graphify-out/graph.json --depth 2` → reverse-impact map for high-risk modules
66
- - `graphify path "<A>" "<B>" --graph graphify-out/graph.json` → shortest dependency path for architecture entries
61
+ 5. **Enrich** with the `enriching-codegraph-proposals` skill — read `arcs proposal list <slug> --json`, decide per-proposal verdicts (keep / merge / drop), persist via `arcs proposal promote` and `arcs proposal drop`. Sub-agents may run read-only codegraph MCP queries for evidence (the MCP server auto-syncs via its own file watcher):
62
+ - `codegraph_search "entry points and main commands"` → seeds for "key files" reference entries
63
+ - `codegraph_explore` on core modules → seeds for "core modules" entries
64
+ - `codegraph_node "<godNodeLabel>"` → structural summary for module entry bodies
65
+ - `codegraph_impact "<critical-symbol>"` → reverse-impact map for high-risk modules
66
+ - `codegraph_callers` / `codegraph_callees "<symbol>"` → dependency paths for architecture entries
67
67
  6. **Hand to typed agents:** the proposals + query results go to the sub-agents listed in **Agent Dispatch** below; they merge graph evidence with code reading and return finalized knowledge entries.
68
68
  7. **Write** the entries directly via `arcs batch --file=ops.json` (one batch invocation for all knowledge entries) or `arcs knowledge create` per entry.
69
69
 
70
- If graphify is missing, log "graphify not on PATH; proceeding without graph signal" and skip steps 3–5. Sub-agents still run; they just lack the graph priors.
70
+ If codegraph is missing, log "codegraph not on PATH; proceeding without graph signal" and skip steps 3–5. Sub-agents still run; they just lack the graph priors.
71
71
 
72
72
  ## Content Guidelines
73
73
 
@@ -87,19 +87,19 @@ If graphify is missing, log "graphify not on PATH; proceeding without graph sign
87
87
  | `tech-architect` | Cross-module couplings, structural gotchas, lessons | `gotcha`, `lesson` |
88
88
  | `qa-analyst` (optional) | Coding-style + convention scan from existing code | `pattern` |
89
89
 
90
- Dispatch in parallel (load `dispatching-parallel-agents`). Each agent receives the relevant `KnowledgeProposal` records from `ingestGraph` plus targeted graphify queries for evidence. Each agent returns finalized proposals (title, kind, summary, keywords, sourceFiles, body) for the orchestrator to write directly via `arcs knowledge create` (or `arcs batch`).
90
+ Dispatch in parallel (load `dispatching-parallel-agents`). Each agent receives the relevant `KnowledgeProposal` records from `ingestGraph` plus targeted codegraph MCP queries for evidence. Each agent returns finalized proposals (title, kind, summary, keywords, sourceFiles, body) for the orchestrator to write directly via `arcs knowledge create` (or `arcs batch`).
91
91
 
92
92
  ## Knowledge Categories for Analysis Sub-Agents
93
93
 
94
94
  | Category | Kind | What to discover | Primary agent |
95
95
  |----------|------|------------------|---------------|
96
96
  | tech stack | `architecture` | Languages, frameworks, runtimes, build tools, versions | `docs-researcher` |
97
- | key files | `reference` | Entry points, config files, main modules, purposes | `docs-researcher` (graphify query "entry points") |
97
+ | key files | `reference` | Entry points, config files, main modules, purposes | `docs-researcher` (codegraph_search "entry points") |
98
98
  | code patterns | `pattern` | Recurring design patterns, abstractions, error handling | `qa-analyst` or `system-architect` |
99
99
  | coding style | `pattern` | Formatting, linting, import ordering, file organization | `qa-analyst` |
100
- | core modules | `module` | Core modules/shared functions — what, where, interconnections | `system-architect` (god nodes from graphify) |
100
+ | core modules | `module` | Core modules/shared functions — what, where, interconnections | `system-architect` (god nodes from codegraph) |
101
101
  | external services | `module` | APIs, databases, message queues the project interacts with | `docs-researcher` |
102
102
  | third-party libraries | `reference` | Key dependencies and why they are used | `docs-researcher` |
103
103
  | features | `feature` | Major user-facing or system-facing features | `docs-researcher` |
104
- | cross-module couplings | `gotcha` | Hot edges between modules surfaced by graphify | `tech-architect` (auto from `ingestGraph`) |
105
- | architecture clusters | `architecture` | Community/directory groupings from graphify | `system-architect` (auto from `ingestGraph`) |
104
+ | cross-module couplings | `gotcha` | Hot edges between modules surfaced by codegraph | `tech-architect` (auto from `ingestGraph`) |
105
+ | architecture clusters | `architecture` | Pseudo-community/directory groupings from codegraph | `system-architect` (auto from `ingestGraph`) |