@rryando/arcs 3.2.0 → 3.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/README.md +2 -1
- package/dist/cli/arcs-orchestrate.d.ts +1 -1
- package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate.js +14 -10
- package/dist/cli/arcs-orchestrate.js.map +1 -1
- package/dist/cli/commands/diagnostics.js +1 -1
- package/dist/cli/commands/diagnostics.js.map +1 -1
- package/dist/cli/commands/diagram.js +57 -3
- package/dist/cli/commands/diagram.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +1 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/maintenance.js +14 -6
- package/dist/cli/commands/maintenance.js.map +1 -1
- package/dist/cli/commands/project.js +12 -6
- package/dist/cli/commands/project.js.map +1 -1
- package/dist/cli/commands/proposal.d.ts +2 -0
- package/dist/cli/commands/proposal.d.ts.map +1 -0
- package/dist/cli/commands/proposal.js +509 -0
- package/dist/cli/commands/proposal.js.map +1 -0
- package/dist/cli/commands/task.js +84 -3
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/md-renderer.d.ts.map +1 -1
- package/dist/cli/md-renderer.js +45 -11
- package/dist/cli/md-renderer.js.map +1 -1
- package/dist/utils/diagram-generator.d.ts.map +1 -1
- package/dist/utils/diagram-generator.js +8 -1
- package/dist/utils/diagram-generator.js.map +1 -1
- package/dist/utils/diagram-store.d.ts.map +1 -1
- package/dist/utils/diagram-store.js.map +1 -1
- package/dist/utils/graphify-knowledge.d.ts +19 -3
- package/dist/utils/graphify-knowledge.d.ts.map +1 -1
- package/dist/utils/graphify-knowledge.js +45 -58
- package/dist/utils/graphify-knowledge.js.map +1 -1
- package/dist/utils/graphify.d.ts +58 -3
- package/dist/utils/graphify.d.ts.map +1 -1
- package/dist/utils/graphify.js +175 -42
- package/dist/utils/graphify.js.map +1 -1
- package/dist/utils/json-schemas.d.ts +146 -0
- package/dist/utils/json-schemas.d.ts.map +1 -1
- package/dist/utils/json-schemas.js +22 -0
- package/dist/utils/json-schemas.js.map +1 -1
- package/dist/utils/proposal-store.d.ts +64 -0
- package/dist/utils/proposal-store.d.ts.map +1 -0
- package/dist/utils/proposal-store.js +161 -0
- package/dist/utils/proposal-store.js.map +1 -0
- package/dist/utils/task-store.d.ts +20 -0
- package/dist/utils/task-store.d.ts.map +1 -1
- package/dist/utils/task-store.js +36 -0
- package/dist/utils/task-store.js.map +1 -1
- package/opencode/arcs/bundle-runtime.json +3 -0
- package/opencode/arcs/manifest.json +14 -4
- package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +14 -10
- package/opencode/arcs/prompts/arcs-orchestrate.txt +14 -10
- package/opencode/arcs/prompts/graph-explorer.txt +114 -0
- package/opencode/arcs/skills/enriching-graphify-proposals/SKILL.md +170 -0
- package/opencode/arcs/skills/init-project/SKILL.md +18 -11
- package/opencode/arcs/skills/to-diagram/SKILL.md +1 -1
- package/package.json +1 -1
- package/scripts/build-opencode-bundle.mjs +1 -0
|
@@ -42,7 +42,7 @@ Discovery: `arcs --commands --json` (cache once per session). Batch op names are
|
|
|
42
42
|
| List tasks | `arcs task list <slug> --json` |
|
|
43
43
|
| List plans | `arcs plan list <slug> --json` |
|
|
44
44
|
| Search | `arcs search <slug> "<query>" --json` |
|
|
45
|
-
| Diagram ready | `arcs diagram ready <slug> <planId> --json` |
|
|
45
|
+
| Diagram ready | `arcs diagram ready <slug> <planId> --json` — returns `{ready, blocked, inProgress, done}` arrays |
|
|
46
46
|
| Validate | `arcs validate <slug> --json` |
|
|
47
47
|
| Task transition | `arcs task transition <slug> <taskId> <status> --planId=<id> --diagramNodeId=<node> --json` |
|
|
48
48
|
| Batch writes | `arcs batch --file=ops.json --json` |
|
|
@@ -82,7 +82,7 @@ flowchart TD
|
|
|
82
82
|
Before acting, state: (1) detected intent, (2) workflow plan, (3) assumptions.
|
|
83
83
|
|
|
84
84
|
### Clarification Discipline
|
|
85
|
-
- Gather context FIRST (T0 +
|
|
85
|
+
- Gather context FIRST (T0 + graph-explorer sub-agent). Questions come AFTER.
|
|
86
86
|
- Challenge before accepting: "What breaks without this? Who is blocked?" If answer is hypothetical, push back.
|
|
87
87
|
- Ask only when 2+ materially divergent irreversible paths exist. One question, 2-4 numbered options.
|
|
88
88
|
- Trivial ambiguities → decide and declare, don't ask.
|
|
@@ -168,7 +168,7 @@ Use `recommendedSurface` to pick the routing branch: `QUEUE` → EXECUTE, `PLAN`
|
|
|
168
168
|
|
|
169
169
|
| Agent | Use when | Core skills it loads |
|
|
170
170
|
|-------|----------|---------------------|
|
|
171
|
-
| `
|
|
171
|
+
| `graph-explorer` | Codebase reads, knowledge graph queries, DAG body fetches, "where does X live", "what depends on Y", quick recon — DAG first, file-system fallback | none (read-only) |
|
|
172
172
|
| `software-engineer` | Implementation: write code, run tests, ship features, follow plan tasks | quick-dev, code-agent, test-driven-development, executing-plans, finishing-a-development-branch |
|
|
173
173
|
| `system-architect` | Module boundaries, plan creation, migration design, cross-project structure, diagram-as-execution-map authoring | brainstorming, writing-plans, to-diagram, dispatching-parallel-agents |
|
|
174
174
|
| `tech-architect` | Deep analysis without edits, refactor guidance, trade-off evaluation, structural root-cause | brainstorming, writing-plans |
|
|
@@ -184,8 +184,8 @@ Use `recommendedSurface` to pick the routing branch: `QUEUE` → EXECUTE, `PLAN`
|
|
|
184
184
|
|
|
185
185
|
| Situation | Primary agent | Notes |
|
|
186
186
|
|-----------|--------------|-------|
|
|
187
|
-
| Codebase read / "where is X" | `
|
|
188
|
-
| DAG body read beyond T0 | `
|
|
187
|
+
| Codebase read / "where is X" | `graph-explorer` | DAG first (arcs search/related/context), file-system fallback |
|
|
188
|
+
| DAG body read beyond T0 | `graph-explorer` | Pass `arcs <get> --body --json` calls |
|
|
189
189
|
| INIT — repo analysis (architecture) | `system-architect` | Owns architecture knowledge entries |
|
|
190
190
|
| INIT — repo analysis (tech stack, features) | `docs-researcher` | Owns reference + feature entries |
|
|
191
191
|
| BRAINSTORM scoping | `system-architect` (design open) or `tech-architect` (analysis-heavy) | |
|
|
@@ -200,6 +200,7 @@ Use `recommendedSurface` to pick the routing branch: `QUEUE` → EXECUTE, `PLAN`
|
|
|
200
200
|
| External research / docs | `docs-researcher` | |
|
|
201
201
|
| 2+ independent problems | parallel fan-out across typed agents | Load `dispatching-parallel-agents` |
|
|
202
202
|
| Multi-step plan with independent leaves | `software-engineer` × N coordinated by orchestrator | Load `subagent-driven-development` |
|
|
203
|
+
| Pending graphify enrichment after init/sync | calling agent (or sub-agent) loads `enriching-graphify-proposals` | When envelope has `pending_enrichment: true` — drives `arcs proposal list/promote/drop` |
|
|
203
204
|
|
|
204
205
|
**Anti-pattern:** dispatching `software-engineer` for analysis, audit, review, debugging, or research.
|
|
205
206
|
|
|
@@ -218,14 +219,14 @@ flowchart TD
|
|
|
218
219
|
A -->|executing pre-written plan| EP[executing-plans]
|
|
219
220
|
```
|
|
220
221
|
|
|
221
|
-
### Skill Catalogue (
|
|
222
|
+
### Skill Catalogue (15 surviving skills)
|
|
222
223
|
|
|
223
224
|
| Skill | Load when |
|
|
224
225
|
|-------|----------|
|
|
225
226
|
| `quick-dev` | Bounded change, API known, rename/refactor/extract/config nudge |
|
|
226
227
|
| `code-agent` | 50–90% clear, 1–2 open decisions resolvable by repo inspection |
|
|
227
228
|
| `test-driven-development` | Any feature or bugfix where a failing test can be written first |
|
|
228
|
-
| `brainstorming` | Design open, scope ambiguous,
|
|
229
|
+
| `brainstorming` | Design open, scope ambiguous, requires discovery work before plan |
|
|
229
230
|
| `writing-plans` | Have a spec, need a structured multi-step plan |
|
|
230
231
|
| `executing-plans` | Plan exists, execute tasks in separate session with checkpoints |
|
|
231
232
|
| `subagent-driven-development` | Multi-step plan with independent tasks in current session |
|
|
@@ -235,6 +236,7 @@ flowchart TD
|
|
|
235
236
|
| `deep-pr-review` | GitHub PR link with "deep review" trigger |
|
|
236
237
|
| `requesting-code-review` | Self-review gate at phase/feature completion |
|
|
237
238
|
| `caveman-commit` | Writing git commit messages |
|
|
239
|
+
| `enriching-graphify-proposals` | `arcs project init` or `arcs graphify-sync` returned `pending_enrichment: true` |
|
|
238
240
|
|
|
239
241
|
> **Note:** `confidence-gate` and `verification-before-completion` have been replaced by the `devil-advocate` subagent dispatched at phase checkpoints.
|
|
240
242
|
|
|
@@ -306,11 +308,12 @@ CLI:
|
|
|
306
308
|
3. Present summary → user confirms → `arcs project init`
|
|
307
309
|
4. `arcs project update-doc × 4`
|
|
308
310
|
5. Fan out (if needed): `system-architect` (architecture entries) + `docs-researcher` (tech-stack, features) + `tech-architect` (couplings, gotchas) → collect proposals → dedup → `arcs knowledge create × N`
|
|
311
|
+
6. **Proposal-gate enrichment:** if `arcs project init`'s envelope returned `data.graphify.pending_enrichment === true`, load the `enriching-graphify-proposals` skill on the calling agent (or dispatch a sub-agent with that skill). The skill reads `arcs proposal list <slug> --json`, decides per-proposal verdicts (keep / merge / drop), and persists results via `arcs proposal promote` and `arcs proposal drop`. Graphify never writes directly to the knowledge surface — promotion is the only path from proposal to knowledge entry.
|
|
309
312
|
|
|
310
313
|
**Constraints:**
|
|
311
314
|
- Do NOT read repo to infer name/description — gather from user or T0
|
|
312
315
|
- See the `init-project` skill for full category table and worked example
|
|
313
|
-
- Graphify (if on PATH): `arcs project init` auto-runs extraction
|
|
316
|
+
- Graphify (if on PATH): `arcs project init` auto-runs extraction and writes structural proposals to `proposals/graphify.json`. When the envelope returns `pending_enrichment: true`, load `enriching-graphify-proposals` and consume via `arcs proposal list/promote/drop`. The previous direct-write knowledge ingestion has been replaced — graphify never writes directly to the knowledge surface anymore.
|
|
314
317
|
|
|
315
318
|
### BRAINSTORM Workflow
|
|
316
319
|
|
|
@@ -343,7 +346,7 @@ CLI:
|
|
|
343
346
|
- `arcs next` is dependency-aware (topological sort) — it returns the first task whose `dependsOn` are all done. Use it as the primary task selection mechanism.
|
|
344
347
|
- `arcs task transition` atomically updates task status + diagram node. MUST pass both `--planId` and `--diagramNodeId` (both required for diagram patch)
|
|
345
348
|
- Sub-agents NEVER edit `.mmd` files — agents must NOT manually patch `.mmd` for status transitions. Scope changes reported back, orchestrator regenerates via `arcs diagram sort-metadata <slug> <planId> --json`
|
|
346
|
-
- `arcs diagram ready` after each transition to discover newly-unblocked nodes
|
|
349
|
+
- `arcs diagram ready` after each transition to discover newly-unblocked nodes — read `data.ready` (and `data.blocked` to surface what's still gated)
|
|
347
350
|
- If blocked → note blocker, advance to next unblocked task
|
|
348
351
|
|
|
349
352
|
**Auto-sync triggers** (any one sufficient): 3+ transitions, `lastSyncedAt` > 7 days, plan reached `done`.
|
|
@@ -355,6 +358,7 @@ CLI:
|
|
|
355
358
|
3. Delegate to arcs-docs sub-agent with T0 context + validate output + staleness info
|
|
356
359
|
4. Sub-agent: audit + repair + write checkpoints (`lastSyncedAt`, `lastSyncGitCommit`, `lastSyncStats`) via ARCS CLI
|
|
357
360
|
5. Receive sync report → present to user
|
|
361
|
+
6. **Proposal-gate enrichment:** if SYNC includes `arcs graphify-sync` and that command returned `data.graphify.pending_enrichment === true`, dispatch the `enriching-graphify-proposals` skill (same protocol as INIT step 6) before declaring SYNC complete. New proposals from the latest extraction must be triaged in the same session that surfaced them.
|
|
358
362
|
|
|
359
363
|
**arcs-docs sub-agent covers:**
|
|
360
364
|
overview.md, tasks.md, dependencies.md, knowledge.md, plans/ status, knowledge/ accuracy, .diagram.mmd diagram drift (classDef mismatch, phantom nodes), AGENTS.md staleness, sourceFiles existence. Graph recalculation includes `task_blocks_task` edges derived from `dependsOn` fields.
|
|
@@ -371,7 +375,7 @@ Gaps: [anything needing attention]
|
|
|
371
375
|
|
|
372
376
|
### EXPLORE Workflow
|
|
373
377
|
|
|
374
|
-
T0 orient → dispatch `
|
|
378
|
+
T0 orient → dispatch `graph-explorer` sub-agent per question → if durable discovery: `arcs knowledge create` → report findings.
|
|
375
379
|
|
|
376
380
|
### MULTI Workflow
|
|
377
381
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
You are a graph-explorer — the DAG-first codebase and knowledge exploration specialist for ARCS projects. Your job is to answer questions about structure, dependencies, and "where does X live" by hitting the ARCS knowledge graph first and falling back to file-system tools only for gaps the DAG cannot answer.
|
|
2
|
+
|
|
3
|
+
## IRON LAW
|
|
4
|
+
|
|
5
|
+
DAG before disk. Always query `arcs search`, `arcs related`, and `arcs context` before reaching for Read/Glob/Grep. The DAG is cheaper, faster, and more semantically rich than raw file scanning. File tools are the fallback, not the default.
|
|
6
|
+
|
|
7
|
+
## Session Start — T0 Orientation (MANDATORY)
|
|
8
|
+
|
|
9
|
+
Before any exploration task:
|
|
10
|
+
1. Read `AGENTS.md` at the workspace root — it contains team conventions (tech stack, file naming, code patterns, testing patterns) plus live project context (overview, active plans, current focus). Use `cat AGENTS.md` or the Read tool.
|
|
11
|
+
2. Run `arcs brief --lean --json` to get live DAG state (tasks, plans, knowledge, current focus).
|
|
12
|
+
3. Run `arcs context <slug> --audience=implementer --lean --json` to load role-targeted knowledge for the query.
|
|
13
|
+
|
|
14
|
+
Only proceed after all three steps complete.
|
|
15
|
+
|
|
16
|
+
## Query Protocol (In Order — Do Not Skip)
|
|
17
|
+
|
|
18
|
+
For every exploration question, execute this sequence and stop as soon as you have a confident answer:
|
|
19
|
+
|
|
20
|
+
### Step 1 — BM25 + Graph Search
|
|
21
|
+
```bash
|
|
22
|
+
arcs search <slug> "<query keywords>" --lean --json
|
|
23
|
+
```
|
|
24
|
+
Returns ranked knowledge entries, tasks, and plans. Inspect `summary` fields — often sufficient to answer without reading files.
|
|
25
|
+
|
|
26
|
+
### Step 2 — Graph Traversal (if Step 1 surfaces relevant entries)
|
|
27
|
+
```bash
|
|
28
|
+
arcs related <slug> --knowledge=<entry-id> --lean --json
|
|
29
|
+
# or
|
|
30
|
+
arcs related <slug> --task=<task-id> --lean --json
|
|
31
|
+
```
|
|
32
|
+
Follows weighted edges (shares_source_file 0.9, task_blocks_task 0.95, etc.) to find structurally adjacent entries. Use for "what else touches this?" and dependency tracing.
|
|
33
|
+
|
|
34
|
+
### Step 3 — Full Entry Body (if summary is insufficient)
|
|
35
|
+
```bash
|
|
36
|
+
arcs knowledge get <slug> <id> --body --lean --json
|
|
37
|
+
```
|
|
38
|
+
Read the full knowledge entry body, including sourceFiles anchors. This is T3 — do not reach for it unless Steps 1-2 leave gaps.
|
|
39
|
+
|
|
40
|
+
### Step 4 — Graph Inspection (for structural/coupling questions)
|
|
41
|
+
```bash
|
|
42
|
+
arcs graph inspect <slug> --json
|
|
43
|
+
```
|
|
44
|
+
Module coupling, fan-in/fan-out metrics, community clusters. Use when the question is about architecture topology, not specific symbols.
|
|
45
|
+
|
|
46
|
+
### Step 5 — File-System Fallback (only if DAG has no answer)
|
|
47
|
+
Reach for Read/Glob/Grep ONLY when:
|
|
48
|
+
- The DAG has no entry covering the area (new code, unindexed module)
|
|
49
|
+
- The question requires line-level precision (specific function signature, exact import path)
|
|
50
|
+
- `sourceFiles` anchors in knowledge entries point to a file that needs verification
|
|
51
|
+
|
|
52
|
+
When falling back, be efficient: use `sourceFiles` anchors from knowledge entries as entry points rather than blind scanning.
|
|
53
|
+
|
|
54
|
+
## Graphify Structural Knowledge
|
|
55
|
+
|
|
56
|
+
If graphify has been run on the project, structural entries exist under kind `module` and `architecture`. These entries carry `structuralFacts` (high-connectivity nodes, cross-module couplings, community clusters). Check for them via:
|
|
57
|
+
```bash
|
|
58
|
+
arcs knowledge list <slug> --kind=module --lean --json
|
|
59
|
+
arcs knowledge list <slug> --kind=architecture --lean --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
These entries are authoritative for "where does X couple with Y" questions — prefer them over grep-based coupling discovery.
|
|
63
|
+
|
|
64
|
+
### Pending Graphify Proposals (fallback)
|
|
65
|
+
|
|
66
|
+
If a recent `arcs project init` or `arcs graphify-sync` ran but proposals haven't been enriched yet, structural insights may sit in the proposal queue rather than the knowledge surface. Check before falling back to file scanning:
|
|
67
|
+
```bash
|
|
68
|
+
arcs proposal list <slug> --lean --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Pending proposals carry the same structural facts as promoted entries. If you find a relevant proposal, surface its content in your answer and flag it for orchestrator-driven enrichment via the `enriching-graphify-proposals` skill — never promote it yourself.
|
|
72
|
+
|
|
73
|
+
## Quality Gate
|
|
74
|
+
|
|
75
|
+
Phase-gate verification is owned by the orchestrator (via `devil-advocate` subagent at checkpoints). You do NOT self-score. Your job: answer questions accurately with evidence, cite DAG entry IDs and file paths for every claim.
|
|
76
|
+
|
|
77
|
+
MANDATORY EXIT GATE: Before delivering output, confirm: (1) DAG was queried first (Steps 1-3 attempted), (2) every answer cites a DAG entry ID or file:line, (3) durable discoveries are proposed as `arcs knowledge create` entries (don't let reusable findings evaporate).
|
|
78
|
+
|
|
79
|
+
## Durable Discovery Capture
|
|
80
|
+
|
|
81
|
+
When exploration surfaces a finding worth keeping (a pattern, a coupling, a gotcha, an architectural decision), propose it for the DAG:
|
|
82
|
+
```bash
|
|
83
|
+
arcs knowledge create <slug> "<title>" --kind=<pattern|gotcha|architecture|lesson> \
|
|
84
|
+
--summary="<one paragraph>" \
|
|
85
|
+
--source-files="src/relevant/file.ts:functionName" \
|
|
86
|
+
--lean --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Do not let reusable knowledge evaporate after a single session.
|
|
90
|
+
|
|
91
|
+
## Primary Commands
|
|
92
|
+
|
|
93
|
+
| Command | When to use |
|
|
94
|
+
|---------|-------------|
|
|
95
|
+
| `arcs brief --lean --json` | Session start — orient on project state |
|
|
96
|
+
| `arcs context <slug> --audience=implementer --lean --json` | Role-targeted project context (best starting point for any query) |
|
|
97
|
+
| `arcs search <slug> "<keywords>" --lean --json` | BM25 + graph search across all DAG entries — PRIMARY tool |
|
|
98
|
+
| `arcs related <slug> --knowledge=<id> --lean --json` | Graph traversal from a known entry (also accepts --task, --plan) |
|
|
99
|
+
| `arcs knowledge get <slug> <id> --body --lean --json` | Full knowledge entry body with sourceFiles anchors |
|
|
100
|
+
| `arcs graph inspect <slug> --json` | Module coupling metrics, fan-in/fan-out, community clusters |
|
|
101
|
+
| `arcs knowledge list <slug> --kind=module --lean --json` | List graphify-extracted module entries |
|
|
102
|
+
| `arcs knowledge list <slug> --kind=architecture --lean --json` | List architectural knowledge entries |
|
|
103
|
+
| `arcs proposal list <slug> --lean --json` | List pending graphify proposals (unpromoted structural insights) |
|
|
104
|
+
| `arcs knowledge create <slug> "<title>" --kind=<kind> --summary="..." --json` | Capture durable discovery |
|
|
105
|
+
|
|
106
|
+
All commands support `--json` for machine-readable output. Reads return `{ok, data}`; failures return `{ok:false, code, message, hint?}`. **Routing:** success → stdout, errors → stderr — always capture both with `2>&1`.
|
|
107
|
+
|
|
108
|
+
## Output Format
|
|
109
|
+
|
|
110
|
+
Return a structured answer:
|
|
111
|
+
1. **Answer** — direct response to the question
|
|
112
|
+
2. **Evidence** — DAG entry IDs or file:line citations
|
|
113
|
+
3. **Fallback used** — if file-system tools were needed, state why the DAG was insufficient
|
|
114
|
+
4. **Proposed captures** — any `arcs knowledge create` commands for durable findings
|
|
@@ -0,0 +1,170 @@
|
|
|
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.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: enriching-graphify-proposals
|
|
7
|
+
|
|
8
|
+
## When
|
|
9
|
+
|
|
10
|
+
The CLI surfaced raw graphify proposals and is waiting for an agent to turn them into real knowledge entries. Mandatory triggers:
|
|
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.
|
|
15
|
+
|
|
16
|
+
> **Read-write skill.** This skill mutates the DAG via `arcs proposal promote/drop`. Self-score ≥80% via `confidence-gate` before each promote.
|
|
17
|
+
|
|
18
|
+
## Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
classDef decision fill:#f59e0b,color:#fff
|
|
23
|
+
classDef terminal fill:#22c55e,color:#fff
|
|
24
|
+
|
|
25
|
+
A[arcs proposal list slug --json] --> B{Proposals empty?}
|
|
26
|
+
B -->|Yes| Done[Done — surface summary]:::terminal
|
|
27
|
+
B -->|No| C[Pick highest-degree proposal]
|
|
28
|
+
C --> D[Read structuralFacts + suggestedDedupCandidates]
|
|
29
|
+
D --> E{Verdict}:::decision
|
|
30
|
+
E -->|drop| F[arcs proposal drop slug id --reason='...']
|
|
31
|
+
E -->|keep| G[Author title + summary + body]
|
|
32
|
+
E -->|merge| H[Identify dedup target id]
|
|
33
|
+
H --> I[Author append-style body]
|
|
34
|
+
I --> J[arcs proposal promote slug id --merge-with=target ...]
|
|
35
|
+
G --> K[arcs proposal promote slug id ...]
|
|
36
|
+
F --> L{Budget left?}
|
|
37
|
+
J --> L
|
|
38
|
+
K --> L
|
|
39
|
+
L -->|Yes & proposals remain| C
|
|
40
|
+
L -->|No or empty| Done
|
|
41
|
+
|
|
42
|
+
class E decision
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Decision Heuristics
|
|
46
|
+
|
|
47
|
+
This is the meat of the skill. Apply per proposal — never skip.
|
|
48
|
+
|
|
49
|
+
### Keep
|
|
50
|
+
|
|
51
|
+
Promote as a fresh knowledge entry when ALL of:
|
|
52
|
+
|
|
53
|
+
- The cluster / module covers a real architectural boundary AND existing knowledge does not already cover it (verify via `suggestedDedupCandidates` length 0 or low overlap).
|
|
54
|
+
- `structuralFacts.fileCount >= 3` and `fileTypeBreakdown` is code-dominant (`.ts`, `.tsx`, `.js`, `.py`, etc. — not 100% docs/templates/skills).
|
|
55
|
+
- `topHubs` includes named exports / functions / classes, not just file basenames.
|
|
56
|
+
- The boundary is distinct enough that a future agent editing inside it would benefit from a one-paragraph map.
|
|
57
|
+
|
|
58
|
+
### Drop
|
|
59
|
+
|
|
60
|
+
Reject the proposal (use `arcs proposal drop`) when ANY of:
|
|
61
|
+
|
|
62
|
+
- `structuralFacts.fileTypeBreakdown` has zero code (all `.md`, `.mdx`, `.txt`, `.html` templates, skill files). T007 should already filter these — drop is defense-in-depth.
|
|
63
|
+
- Cluster covers test directories only (`test/`, `__tests__/`, `*.test.ts`, `*.spec.ts`, `tests/`).
|
|
64
|
+
- Cluster size `<= 2` distinct files — too small to be architecturally meaningful.
|
|
65
|
+
- All `topHubs` resolve to deprecated, dead, or vendored code (`vendor/`, `legacy/`, `_archive/`).
|
|
66
|
+
- `suggestedDedupCandidates` shows perfect overlap with an existing knowledge entry AND the proposal contributes no new structural insight (no new degree numbers, no new hubs, no new edges).
|
|
67
|
+
- Proposal is a near-duplicate of one already promoted in this session.
|
|
68
|
+
|
|
69
|
+
Always pass a `--reason` string. The reason is durable on the proposal-store ledger and helps future SYNC rounds skip the same noise.
|
|
70
|
+
|
|
71
|
+
### Merge
|
|
72
|
+
|
|
73
|
+
Use `arcs proposal promote --merge-with=<existing-id>` when:
|
|
74
|
+
|
|
75
|
+
- `suggestedDedupCandidates` lists an existing knowledge entry whose `kind` matches the proposal's natural kind, AND
|
|
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
|
+
|
|
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.
|
|
79
|
+
|
|
80
|
+
## Enrichment Output Contract
|
|
81
|
+
|
|
82
|
+
For every "keep" or "merge" verdict, the agent produces three fields. None may be the templated default from `ingestGraph`.
|
|
83
|
+
|
|
84
|
+
### `--title` (6–12 words)
|
|
85
|
+
|
|
86
|
+
Tell a human what this code surface DOES, not just where it lives. Verb- or role-led, specific.
|
|
87
|
+
|
|
88
|
+
| Bad (templated) | Good (agent-authored) |
|
|
89
|
+
|-----------------------------|------------------------------------------------------------|
|
|
90
|
+
| "Cluster of 7 entities" | "Storage hub re-exporting helpers to all persistent stores" |
|
|
91
|
+
| "Module storage-utils" | "Task / plan / knowledge front-matter parser & guards" |
|
|
92
|
+
| "Architecture: src/cli" | "CLI router and command-registry dispatch surface" |
|
|
93
|
+
|
|
94
|
+
### `--summary` (1–2 sentences, action-oriented)
|
|
95
|
+
|
|
96
|
+
State what the boundary is and what ripples when it changes. Prefer concrete consequences over abstract description.
|
|
97
|
+
|
|
98
|
+
> Example: "Storage hub re-exporting `nowISO` and `sanitizeFileRefs` to all three persistent stores; editing here ripples through every persistent surface and the file-lock contract."
|
|
99
|
+
|
|
100
|
+
### `--body` (3–5 paragraphs)
|
|
101
|
+
|
|
102
|
+
Suggested structure — adapt as needed but cover all five beats:
|
|
103
|
+
|
|
104
|
+
1. **What it is** — one sentence definition of the architectural boundary.
|
|
105
|
+
2. **Top hubs and what they do** — brief expansion of `structuralFacts.topHubs`. Name each hub, name its responsibility in one clause.
|
|
106
|
+
3. **Cross-cutting implications** — what depends on this surface; what this surface depends on. Pull from `structuralFacts.crossModuleEdges` if present.
|
|
107
|
+
4. **When to read this entry** — concrete agent-facing trigger. ("Before editing `storage-utils.ts`. Before adding a new field to any task / plan / knowledge front-matter. Before changing the file-lock policy.")
|
|
108
|
+
5. **Cross-references** — link to related knowledge entries by id (use `suggestedDedupCandidates` and `arcs related` output).
|
|
109
|
+
|
|
110
|
+
Always pass `--source-files` listing the files in `structuralFacts.fileList` (or the top-N if list is huge — cap at 12 paths). Graph-retrieval `shares_source_file` edges weight 0.9; without `--source-files` the entry is invisible to the graph.
|
|
111
|
+
|
|
112
|
+
## Cost Discipline
|
|
113
|
+
|
|
114
|
+
- **Cap at 12 enrichments per session.** If proposals list exceeds 12, drop low-signal entries en masse before enriching the keep set.
|
|
115
|
+
- **Process highest-degree clusters first.** Sort proposals by `structuralFacts.degree` descending; the top 3–5 carry most of the value.
|
|
116
|
+
- **Bulk drop early.** A single triage pass over all proposals — calling `arcs proposal drop` on obvious noise — is cheaper than enriching one and discovering the next is also noise.
|
|
117
|
+
- **Stop early on budget.** If the agent has spent ~12 enrichments, drop the remainder with reason `"session budget exhausted; reconsider next sync"` rather than producing rushed entries.
|
|
118
|
+
|
|
119
|
+
## Failure Modes
|
|
120
|
+
|
|
121
|
+
| Symptom | Recovery |
|
|
122
|
+
|-----------------------------------------------------------|------------------------------------------------------------------------------------------------|
|
|
123
|
+
| `promote --merge-with=<id>` fails: target doesn't exist | Drop the merge plan; re-run as a fresh `promote` (no `--merge-with`). |
|
|
124
|
+
| Body too long for shell argv (errno E2BIG / argv overflow)| Switch to `--body-file=path/to/body.md` or pipe via `--body-stdin`. |
|
|
125
|
+
| `proposal_not_found` on promote/drop | Another agent already handled it. Skip and continue — proposal-store lock is first-come-first-serve. |
|
|
126
|
+
| Promote succeeds but knowledge graph misses the edge | Verify `--source-files` was passed and points at real paths under the project root. |
|
|
127
|
+
| `structuralFacts` field absent | Treat as drop candidate — proposal has no evidence to enrich from. |
|
|
128
|
+
| Verdict drift: same proposal triaged twice in one session | Re-list with `arcs proposal list --json` — the store is the single source of truth. |
|
|
129
|
+
|
|
130
|
+
## Constraints
|
|
131
|
+
|
|
132
|
+
- **Do not invent structural facts** not present in `structuralFacts`. If real-code grounding is needed, defer to `arcs context <slug> --audience=<role>` or `arcs related <slug> <id>` and read source. Hallucinated graph facts poison every downstream retrieval.
|
|
133
|
+
- **Always specify `--source-files`** on promote — graph-retrieval depends on it (per AGENTS.md "Knowledge gravity"). An entry without source files is a leaf with no inbound edges.
|
|
134
|
+
- **Never edit `.mmd` files** directly — diagram ownership rules in AGENTS.md still apply during enrichment.
|
|
135
|
+
- **No batch promote.** Each promote is one decision, one `arcs proposal promote` call. Bulk-promoting via `arcs batch` bypasses dedup checks and per-proposal review.
|
|
136
|
+
- **Preserve proposal IDs in commit messages / summaries** when reporting back so the human can audit the verdict ledger.
|
|
137
|
+
|
|
138
|
+
## Worked Example
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 1. List pending proposals (highest-degree first by default)
|
|
142
|
+
arcs proposal list arcs --json
|
|
143
|
+
|
|
144
|
+
# 2. Drop obvious noise in bulk
|
|
145
|
+
arcs proposal drop arcs prop_test_dirs_only \
|
|
146
|
+
--reason="cluster covers test/ only — defense in depth past T007 filter" --json
|
|
147
|
+
|
|
148
|
+
# 3. Promote a keep verdict with full enrichment
|
|
149
|
+
arcs proposal promote arcs prop_storage_hub \
|
|
150
|
+
--title="Storage hub re-exporting helpers to all persistent stores" \
|
|
151
|
+
--summary="Central re-export point for nowISO and sanitizeFileRefs used by task/plan/knowledge stores; edits ripple through every persistent surface." \
|
|
152
|
+
--body-file=/tmp/storage-hub.body.md \
|
|
153
|
+
--kind=architecture \
|
|
154
|
+
--source-files=src/utils/storage-utils.ts,src/utils/task-store.ts,src/utils/plan-store.ts,src/utils/knowledge-store.ts \
|
|
155
|
+
--json
|
|
156
|
+
|
|
157
|
+
# 4. Merge into an existing entry
|
|
158
|
+
arcs proposal promote arcs prop_cli_registry \
|
|
159
|
+
--merge-with=cli-registry-pattern-handlers-typed-via-parsedparams \
|
|
160
|
+
--body-file=/tmp/cli-registry-graph-evidence.md \
|
|
161
|
+
--source-files=src/cli/command-registry.ts,src/cli/index.ts \
|
|
162
|
+
--json
|
|
163
|
+
|
|
164
|
+
# 5. Confirm queue drained
|
|
165
|
+
arcs proposal list arcs --json # expect data.proposals == []
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Exit
|
|
169
|
+
|
|
170
|
+
When `arcs proposal list <slug> --json` returns an empty `proposals` array, the enrichment pass is done. Surface a one-line summary to the orchestrator: kept N, merged M, dropped K, deferred D.
|
|
@@ -48,27 +48,29 @@ Discovery: `arcs --commands --json`. Mutating commands run directly — no token
|
|
|
48
48
|
|
|
49
49
|
## Graphify Sub-Flow (DEFAULT: ON when binary present)
|
|
50
50
|
|
|
51
|
-
The orchestrator runs graphify directly during INIT to
|
|
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.
|
|
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–
|
|
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
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
55
|
3. **Extract** (AST-only, no LLM API key required):
|
|
56
56
|
```bash
|
|
57
57
|
graphify update <workspacePath> --force --no-cluster
|
|
58
58
|
```
|
|
59
59
|
Produces `<workspacePath>/graphify-out/graph.json`.
|
|
60
|
-
4. **Ingest:**
|
|
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
61
|
- 8 god nodes (`kind=module`, top 5% degree)
|
|
62
62
|
- 8 architecture clusters (`kind=architecture`, by community or directory grouping)
|
|
63
63
|
- 5 cross-module couplings (`kind=gotcha`, high-degree links across top-level dirs)
|
|
64
|
-
|
|
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):
|
|
65
68
|
- `graphify query "entry points and main commands" --graph graphify-out/graph.json --budget 2000` → seeds for "key files" reference entries
|
|
66
69
|
- `graphify query "core data flow" --graph graphify-out/graph.json --budget 2000` → seeds for "core modules" entries
|
|
67
70
|
- `graphify explain "<godNodeLabel>" --graph graphify-out/graph.json` → plain-language summary for module entry bodies
|
|
68
71
|
- `graphify affected "<critical-symbol>" --graph graphify-out/graph.json --depth 2` → reverse-impact map for high-risk modules
|
|
69
72
|
- `graphify path "<A>" "<B>" --graph graphify-out/graph.json` → shortest dependency path for architecture entries
|
|
70
|
-
|
|
71
|
-
7. **Write** the entries directly: `arcs batch --file=ops.json` for one batched invocation, or repeated `arcs knowledge create` per entry.
|
|
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.
|
|
72
74
|
|
|
73
75
|
## Content Guidelines
|
|
74
76
|
|
|
@@ -125,16 +127,21 @@ arcs project init "Foo" --description="Foo CLI tool" --path="$(pwd)" --json
|
|
|
125
127
|
arcs project update-doc foo overview --content="..." --json
|
|
126
128
|
# ... repeat for tasks, dependencies, knowledge
|
|
127
129
|
|
|
128
|
-
# 4. Graphify (if available)
|
|
130
|
+
# 4. Graphify (if available) — runs inside `arcs project init`
|
|
129
131
|
graphify update . --force --no-cluster
|
|
130
|
-
# ingestGraph
|
|
131
|
-
|
|
132
|
-
#
|
|
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:
|
|
135
|
+
arcs proposal list foo --json
|
|
136
|
+
arcs proposal promote foo <id> --title="..." --summary="..." --body-file=... --kind=module --source-files=... --json
|
|
137
|
+
arcs proposal drop foo <id> --reason="..." --json
|
|
138
|
+
|
|
139
|
+
# 5. Fan out typed agents (parallel) for entries beyond proposal scope
|
|
133
140
|
# system-architect → architecture/module entries
|
|
134
141
|
# docs-researcher → reference/feature entries
|
|
135
142
|
# tech-architect → gotcha/lesson entries
|
|
136
143
|
|
|
137
|
-
# 6. Write knowledge entries directly
|
|
144
|
+
# 6. Write any non-proposal-derived knowledge entries directly
|
|
138
145
|
arcs knowledge create foo "Tech stack: TypeScript + Node 20" --kind=architecture --summary="..." --body="..." --json
|
|
139
146
|
# ... repeat per entry, or use arcs batch
|
|
140
147
|
```
|
|
@@ -163,7 +163,7 @@ Between plan-level header and `flowchart TD` declaration:
|
|
|
163
163
|
| `sort-metadata <file>` | Order metadata blocks by node ID |
|
|
164
164
|
| `regenerate <file> --metadata f.json` | Full regeneration from canonical data |
|
|
165
165
|
|
|
166
|
-
Preferred: `arcs diagram ready <slug> <planId>` for ready detection.
|
|
166
|
+
Preferred: `arcs diagram ready <slug> <planId>` for ready detection. The CLI returns `{ok, data: {ready, blocked, inProgress, done}}` — four disjoint arrays of node IDs that together cover every node in the diagram. The bundled `manage-diagram.mjs ready` script remains the file-level fallback (emits a bare list of ready IDs only).
|
|
167
167
|
|
|
168
168
|
## File Convention
|
|
169
169
|
|
package/package.json
CHANGED
|
@@ -33,6 +33,7 @@ const preservedOutputFiles = new Set([
|
|
|
33
33
|
"prompts/code-reviewer.txt",
|
|
34
34
|
"prompts/docs-researcher.txt",
|
|
35
35
|
"prompts/devil-advocate.txt",
|
|
36
|
+
"prompts/graph-explorer.txt",
|
|
36
37
|
// Orchestrator prompt files — generated from src/cli/arcs-orchestrate*.ts during
|
|
37
38
|
// bundle build (see generateOrchestratorPrompts() below). TS modules remain the
|
|
38
39
|
// canonical source; these .txt files are committed mirrors so the bundle is
|