@rryando/arcs 3.2.0 → 3.2.1

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 (57) hide show
  1. package/dist/cli/arcs-orchestrate.d.ts +1 -1
  2. package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
  3. package/dist/cli/arcs-orchestrate.js +8 -4
  4. package/dist/cli/arcs-orchestrate.js.map +1 -1
  5. package/dist/cli/commands/diagnostics.js +1 -1
  6. package/dist/cli/commands/diagnostics.js.map +1 -1
  7. package/dist/cli/commands/diagram.js +57 -3
  8. package/dist/cli/commands/diagram.js.map +1 -1
  9. package/dist/cli/commands/index.d.ts +1 -0
  10. package/dist/cli/commands/index.d.ts.map +1 -1
  11. package/dist/cli/commands/index.js +1 -0
  12. package/dist/cli/commands/index.js.map +1 -1
  13. package/dist/cli/commands/maintenance.js +14 -6
  14. package/dist/cli/commands/maintenance.js.map +1 -1
  15. package/dist/cli/commands/project.js +12 -6
  16. package/dist/cli/commands/project.js.map +1 -1
  17. package/dist/cli/commands/proposal.d.ts +2 -0
  18. package/dist/cli/commands/proposal.d.ts.map +1 -0
  19. package/dist/cli/commands/proposal.js +509 -0
  20. package/dist/cli/commands/proposal.js.map +1 -0
  21. package/dist/cli/commands/task.js +84 -3
  22. package/dist/cli/commands/task.js.map +1 -1
  23. package/dist/cli/md-renderer.d.ts.map +1 -1
  24. package/dist/cli/md-renderer.js +45 -11
  25. package/dist/cli/md-renderer.js.map +1 -1
  26. package/dist/utils/diagram-generator.d.ts.map +1 -1
  27. package/dist/utils/diagram-generator.js +8 -1
  28. package/dist/utils/diagram-generator.js.map +1 -1
  29. package/dist/utils/diagram-store.d.ts.map +1 -1
  30. package/dist/utils/diagram-store.js.map +1 -1
  31. package/dist/utils/graphify-knowledge.d.ts +19 -3
  32. package/dist/utils/graphify-knowledge.d.ts.map +1 -1
  33. package/dist/utils/graphify-knowledge.js +45 -58
  34. package/dist/utils/graphify-knowledge.js.map +1 -1
  35. package/dist/utils/graphify.d.ts +58 -3
  36. package/dist/utils/graphify.d.ts.map +1 -1
  37. package/dist/utils/graphify.js +175 -42
  38. package/dist/utils/graphify.js.map +1 -1
  39. package/dist/utils/json-schemas.d.ts +146 -0
  40. package/dist/utils/json-schemas.d.ts.map +1 -1
  41. package/dist/utils/json-schemas.js +22 -0
  42. package/dist/utils/json-schemas.js.map +1 -1
  43. package/dist/utils/proposal-store.d.ts +64 -0
  44. package/dist/utils/proposal-store.d.ts.map +1 -0
  45. package/dist/utils/proposal-store.js +161 -0
  46. package/dist/utils/proposal-store.js.map +1 -0
  47. package/dist/utils/task-store.d.ts +20 -0
  48. package/dist/utils/task-store.d.ts.map +1 -1
  49. package/dist/utils/task-store.js +36 -0
  50. package/dist/utils/task-store.js.map +1 -1
  51. package/opencode/arcs/bundle-runtime.json +3 -0
  52. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +8 -4
  53. package/opencode/arcs/prompts/arcs-orchestrate.txt +8 -4
  54. package/opencode/arcs/skills/enriching-graphify-proposals/SKILL.md +170 -0
  55. package/opencode/arcs/skills/init-project/SKILL.md +18 -11
  56. package/opencode/arcs/skills/to-diagram/SKILL.md +1 -1
  57. package/package.json +1 -1
@@ -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 seed knowledge entries with structural evidence before any sub-agent reads code. This is the default path when `graphify` is on PATH; skip cleanly otherwise.
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–5.
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:** call internal `ingestGraph(graphJsonPath, slug)` up to 20 `KnowledgeProposal` records (test files filtered):
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
- 5. **Enrich** with read-only graph queries (sub-agents may run these):
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
- 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.
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 produces proposals; enrich with graphify query/explain
131
-
132
- # 5. Fan out typed agents (parallel)
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. Script is fallback for file-level ops.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rryando/arcs",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
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",