@rryando/arcs 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -19
- package/dist/cli/arcs-flash.d.ts +1 -1
- package/dist/cli/arcs-flash.d.ts.map +1 -1
- package/dist/cli/arcs-flash.js +9 -50
- package/dist/cli/arcs-flash.js.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -2
- package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.js +2 -8
- package/dist/cli/arcs-orchestrate-caveman.js.map +1 -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 +4 -54
- package/dist/cli/arcs-orchestrate.js.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.d.ts +10 -30
- package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.js +46 -128
- package/dist/cli/orchestrator-shared-blocks.js.map +1 -1
- package/dist/utils/diagram-generator.d.ts.map +1 -1
- package/dist/utils/diagram-generator.js +11 -6
- package/dist/utils/diagram-generator.js.map +1 -1
- package/opencode/arcs/bundle-runtime.json +0 -3
- package/opencode/arcs/manifest.json +8 -25
- package/opencode/arcs/prompts/arcs-docs.txt +19 -157
- package/opencode/arcs/prompts/arcs-flash.txt +49 -152
- package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +47 -165
- package/opencode/arcs/prompts/arcs-orchestrate.txt +46 -158
- package/opencode/arcs/prompts/code-reviewer.txt +20 -60
- package/opencode/arcs/prompts/graph-explorer.txt +19 -49
- package/opencode/arcs/prompts/software-engineer.txt +21 -67
- package/opencode/arcs/prompts/tech-architect.txt +20 -130
- package/opencode/arcs/skills/brainstorming/SKILL.md +20 -100
- package/opencode/arcs/skills/brainstorming/visual-companion.md +6 -264
- package/opencode/arcs/skills/caveman-commit/SKILL.md +6 -43
- package/opencode/arcs/skills/deep-pr-review/SKILL.md +18 -200
- package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +7 -93
- package/opencode/arcs/skills/deep-pr-review/review-template.md +13 -60
- package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +16 -156
- package/opencode/arcs/skills/implementation/SKILL.md +20 -46
- package/opencode/arcs/skills/init-project/SKILL.md +12 -150
- package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +13 -133
- package/opencode/arcs/skills/systematic-debugging/SKILL.md +13 -152
- package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +7 -110
- package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +7 -119
- package/opencode/arcs/skills/systematic-debugging/phases-reference.md +9 -166
- package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +8 -165
- package/opencode/arcs/skills/test-driven-development/SKILL.md +10 -61
- package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +7 -154
- package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +8 -295
- package/opencode/arcs/skills/to-diagram/SKILL.md +18 -206
- package/opencode/arcs/skills/writing-knowledge/SKILL.md +11 -63
- package/opencode/arcs/skills/writing-plans/SKILL.md +25 -118
- package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +10 -61
- package/package.json +1 -1
- package/skills/explore-dag.md +9 -52
- package/skills/init-project.md +9 -98
- package/skills/orchestrate.md +15 -109
- package/skills/update-docs.md +9 -60
- package/opencode/arcs/prompts/devil-advocate.txt +0 -79
- package/opencode/arcs/skills/executing-plans/SKILL.md +0 -49
|
@@ -1,218 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: deep-pr-review
|
|
3
|
-
description:
|
|
3
|
+
description: Review a GitHub PR deeply and post only after explicit user confirmation
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Deep PR Review
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Boundary
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Remain read-only until the user confirms the exact posting mode and payload. Never auto-approve. Use one GitHub write for the final review.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Gather Once
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Cache repository metadata, PR metadata, and the diff once:
|
|
15
15
|
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
A[User: 'deep review' + PR URL] --> B[Gather phase — see Data Gathering section]
|
|
21
|
-
B --> C{cwd repo == PR repo?}
|
|
22
|
-
C -->|no| Z[Halt — wrong checkout]:::bail
|
|
23
|
-
C -->|yes| D{Label = wip/draft?}
|
|
24
|
-
D -->|yes| D1[Soften severity — flag as WIP]
|
|
25
|
-
D -->|no| D2[Standard severity]
|
|
26
|
-
D1 & D2 --> E[arcs context --audience=implementer --lean --json]
|
|
27
|
-
E -->|found| F[Load AGENTS.md + targeted arcs search]
|
|
28
|
-
E -->|missing| G[Degraded mode — heuristics only]
|
|
29
|
-
F --> H{Prior AI review exists?}
|
|
30
|
-
G --> H
|
|
31
|
-
H -->|yes| I[Diff against prior review commit_id only]
|
|
32
|
-
H -->|no| J[Use full PR diff]
|
|
33
|
-
I --> K[Pick adaptive rubric from diff context]
|
|
34
|
-
J --> K
|
|
35
|
-
K --> L{Diff size?}
|
|
36
|
-
L -->|huge >40 files OR >2000 lines| M[Force summary mode]
|
|
37
|
-
L -->|normal| N{codegraph available?}
|
|
38
|
-
N -->|yes| O[Run impact/query on changed symbols]
|
|
39
|
-
N -->|no| P[Skip coupling check — note in report]
|
|
40
|
-
M --> Q[Aggregate findings + cite each]
|
|
41
|
-
O --> Q
|
|
42
|
-
P --> Q
|
|
43
|
-
Q --> R[Present report + 5 posting modes]
|
|
44
|
-
R --> S{User choice}
|
|
45
|
-
S -->|don't post| END1[Show report only]
|
|
46
|
-
S -->|post| T[gh api: review + inline comments]
|
|
47
|
-
T --> U{Recurring pattern surfaced?}
|
|
48
|
-
U -->|yes| V[Propose arcs knowledge upsert in report — ARCS-write opt-in to apply]
|
|
49
|
-
U -->|no| END2[Done]
|
|
50
|
-
V --> END2
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Data Gathering (ONE PASS — no repeat `gh` reads)
|
|
54
|
-
|
|
55
|
-
Run these three commands once at the start. Cache the results. All downstream steps read from cache — never call `gh repo view` or `gh pr view` again.
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
1. gh repo view --json name,owner → REPO
|
|
59
|
-
2. gh pr view <number> --json number,title,body,author,labels,reviews,state,files,headRefName,baseRefName → PR_META
|
|
60
|
-
3. gh pr diff <number> → DIFF
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
| Downstream need | Read from |
|
|
64
|
-
|-----------------|-----------|
|
|
65
|
-
| Repo-match check | `REPO.name`, `REPO.owner` |
|
|
66
|
-
| WIP / draft check | `PR_META.labels`, `PR_META.state` |
|
|
67
|
-
| Author context | `PR_META.author` |
|
|
68
|
-
| Prior review detection | `PR_META.reviews` |
|
|
69
|
-
| File list / LOC delta | `PR_META.files` |
|
|
70
|
-
| Diff text | `DIFF` |
|
|
71
|
-
|
|
72
|
-
`codegraph-diff.md` receives this cached `DIFF` snapshot; it must not run a second diff fetch.
|
|
73
|
-
|
|
74
|
-
## Adaptive Rubric
|
|
75
|
-
|
|
76
|
-
Agent picks dimensions from diff context. **Correctness is always evaluated.** Other dimensions activate when the diff signals them:
|
|
77
|
-
|
|
78
|
-
| Dimension | Activates when |
|
|
79
|
-
|-----------|----------------|
|
|
80
|
-
| **Correctness** | Always — bugs, off-by-one, error handling, null safety |
|
|
81
|
-
| **DRY** | New code resembles existing patterns; cross-module grep finds duplicates |
|
|
82
|
-
| **KISS** | New abstraction layers, deep nesting, premature generalization |
|
|
83
|
-
| **YAGNI** | Code written "for later" with no current caller; abstractions with one concrete use; configurable hooks with one known value; generic machinery built for hypothetical consumers |
|
|
84
|
-
| **SOLID** | Module gains responsibilities, dependency direction shifts, large classes touched |
|
|
85
|
-
| **Convention fit** | AGENTS.md or DAG `pattern`/`architecture` knowledge applies to changed files |
|
|
86
|
-
| **Architectural risk** → handoff to the tech-architect agent (structural audit) | Diff crosses module boundaries, touches god nodes, changes public API |
|
|
87
|
-
| **Performance/incident risk** → handoff to the software-engineer agent in incident mode with systematic-debugging | Hot paths, loops over external IO, new queries, allocations in render |
|
|
88
|
-
|
|
89
|
-
Skipped dimensions are reported as `cleared (not applicable: <reason>)`. Never silently dropped.
|
|
90
|
-
|
|
91
|
-
## Over-engineering / bloat pass
|
|
92
|
-
|
|
93
|
-
A focused pass that hunts ONLY over-engineering and complexity — correctness, security, and performance stay in the normal review pass above. Runs on a diff (delete-list for the changed lines) OR whole-repo (bloat audit). Lists findings only; applies nothing.
|
|
94
|
-
|
|
95
|
-
One finding per line, tagged:
|
|
96
|
-
|
|
97
|
-
| Tag | Catches | Replacement |
|
|
98
|
-
|-----|---------|-------------|
|
|
99
|
-
| `delete:` | Dead code, unused flexibility, speculative feature | nothing |
|
|
100
|
-
| `stdlib:` | Hand-rolled thing the standard library ships | name the function |
|
|
101
|
-
| `native:` | Dependency or code doing what the platform already does | name the feature |
|
|
102
|
-
| `yagni:` | Abstraction with one implementation, config nobody sets, layer with one caller | inline / remove |
|
|
103
|
-
| `shrink:` | Same logic in fewer lines | show the shorter form |
|
|
104
|
-
|
|
105
|
-
Format: `L<line>: <tag> <what>. <replacement>.` — use `<file>:L<line>: ...` for multi-file or whole-repo audits.
|
|
106
|
-
|
|
107
|
-
End with the only metric that matters: `net: -<N> lines, -<M> deps possible.` Nothing to cut → `Lean already. Ship.`
|
|
108
|
-
|
|
109
|
-
Boundary: never flag the single runnable check that implementation minimalism requires for non-trivial logic as bloat.
|
|
110
|
-
|
|
111
|
-
## Severity Prefixes
|
|
112
|
-
|
|
113
|
-
Inline findings are one line — `<file>:L<line>: problem. fix.` — prefixed by severity:
|
|
114
|
-
|
|
115
|
-
| Prefix | Meaning | Posting default |
|
|
116
|
-
|--------|---------|-----------------|
|
|
117
|
-
| `🔴 bug:` | Broken behavior, will cause incident | Always post |
|
|
118
|
-
| `🟠 risk:` | Works but fragile, edge case unhandled | Always post |
|
|
119
|
-
| `🟡 suggestion:` | Concrete fix improving quality | Posted in modes 2/3 |
|
|
120
|
-
| `🔵 nit:` | Style / naming / minor consistency | Posted only in mode 3 |
|
|
121
|
-
| `❓ q:` | Genuine question for the author | Always post |
|
|
122
|
-
|
|
123
|
-
## Posting Modes
|
|
124
|
-
|
|
125
|
-
User picks one before any `gh` write:
|
|
126
|
-
|
|
127
|
-
| # | Mode | What posts |
|
|
128
|
-
|---|------|------------|
|
|
129
|
-
| 1 | **Critical-only** | 🔴 bug + 🟠 risk + ❓ q only |
|
|
130
|
-
| 2 | **Critical + actionable** | Above + 🟡 suggestion |
|
|
131
|
-
| 3 | **All findings** | Above + 🔵 nit |
|
|
132
|
-
| 4 | **Summary only** | Single top-level review body, no inline comments |
|
|
133
|
-
| 5 | **Don't post** | Show report only — no `gh` calls |
|
|
134
|
-
|
|
135
|
-
## Iron Law
|
|
136
|
-
|
|
137
|
-
**READ ONLY until user picks a posting mode.** No `gh` writes, no ARCS writes, no auto-approve. Approval is only ever produced via explicit user override (`approve it`, `lgtm post approve`) — never inferred from finding count.
|
|
138
|
-
|
|
139
|
-
## Citation Rule
|
|
140
|
-
|
|
141
|
-
Every finding cites a source. No uncited findings:
|
|
142
|
-
|
|
143
|
-
- `see knowledge/<id>: <title>` — ARCS knowledge entry
|
|
144
|
-
- `AGENTS.md §<section>` — project convention
|
|
145
|
-
- `codegraph: <observation>` — coupling/impact result
|
|
146
|
-
- `principle: <KISS|DRY|YAGNI|SOLID|correctness>` — first-principles label
|
|
147
|
-
|
|
148
|
-
If only first-principles applies, that is sufficient — but it must be stated.
|
|
149
|
-
|
|
150
|
-
## Inline Suggestion Rule
|
|
151
|
-
|
|
152
|
-
GitHub ````suggestion` blocks render an "Apply suggestion" button. Use **only** when the fix is a one-to-few-line replacement of existing lines on the diff. For larger fixes:
|
|
153
|
-
|
|
154
|
-
- Multi-line code restructure → inline review comment with a fenced code block (no `suggestion` tag)
|
|
155
|
-
- Missing block / new file content → top-level review body bullet
|
|
156
|
-
- Cross-file refactor → handoff finding recommending the tech-architect agent (structural audit)
|
|
157
|
-
|
|
158
|
-
## Posting Protocol (ONE `gh api` call — never per-finding)
|
|
159
|
-
|
|
160
|
-
All findings are batched into a **single** GitHub review submission. Never loop through findings and post each one individually.
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
gh api POST /repos/{owner}/{repo}/pulls/{number}/reviews \
|
|
164
|
-
--field commit_id="<PR head SHA from PR_META>" \
|
|
165
|
-
--field event="COMMENT" \
|
|
166
|
-
--field body="<top-level summary>" \
|
|
167
|
-
--field 'comments=[{"path":"...","position":N,"body":"..."},...]'
|
|
16
|
+
```bash
|
|
17
|
+
gh repo view --json name,owner
|
|
18
|
+
gh pr view <number> --json number,title,body,author,labels,reviews,state,files,headRefName,baseRefName
|
|
19
|
+
gh pr diff <number>
|
|
168
20
|
```
|
|
169
21
|
|
|
170
|
-
|
|
171
|
-
|------|--------|
|
|
172
|
-
| One call per review session | Top-level body + all inline comments in the same `comments[]` array |
|
|
173
|
-
| Never mix `gh pr review` and `gh api` | Pick one entry point — use `gh api` for full control; `gh pr review` for body-only (mode 4) |
|
|
174
|
-
| Never call `gh pr comment` after `gh api reviews` | `gh pr comment` adds a stand-alone comment, not a review — it will duplicate the top-level body |
|
|
175
|
-
| Dry-run before sending | Print the full payload to the user for confirmation; only call `gh api` once user confirms |
|
|
176
|
-
|
|
177
|
-
### Mode → command mapping
|
|
22
|
+
Verify the current checkout matches the PR repository. Reuse the cached diff for review and optional `codegraph-diff.md` analysis.
|
|
178
23
|
|
|
179
|
-
|
|
180
|
-
|------|---------|
|
|
181
|
-
| 1–3 (inline + summary) | `gh api POST .../reviews` with `body` + `comments[]` — **one call** |
|
|
182
|
-
| 4 (summary only) | `gh pr review <number> --comment --body "..."` — **one call, no `comments[]`** |
|
|
183
|
-
| 5 (don't post) | No `gh` writes |
|
|
24
|
+
## Review
|
|
184
25
|
|
|
185
|
-
|
|
26
|
+
Check correctness first, then activate only relevant dimensions: security, tests, compatibility, KISS/YAGNI/DRY, architecture, and performance. Cite every finding with a diff location and consequence. Large PRs may use summary mode.
|
|
186
27
|
|
|
187
|
-
|
|
28
|
+
Present findings and ask the user to choose: critical-only, actionable, all, summary-only, or do not post. Show the exact payload before confirmation.
|
|
188
29
|
|
|
189
|
-
|
|
30
|
+
For inline modes, batch summary and comments into one `gh api POST .../reviews` call. For summary-only, use one `gh pr review --comment` call. Do not mix posting methods or post comments one by one.
|
|
190
31
|
|
|
191
|
-
|
|
192
|
-
# Deep PR Review: <repo>#<number> — <title>
|
|
193
|
-
## Pre-flight (repo match, PR state, prior reviews)
|
|
194
|
-
## Scope (files touched, LOC delta, modules affected)
|
|
195
|
-
## Rubric Selection (which dimensions activated, why)
|
|
196
|
-
## Findings (grouped by severity)
|
|
197
|
-
## Cleared Dimensions (with evidence)
|
|
198
|
-
## Knowledge Proposals (recurring findings → proposed arcs knowledge upsert, ARCS-write opt-in)
|
|
199
|
-
## Architectural / Performance Handoffs (if any)
|
|
200
|
-
## Posting Plan (mode chosen → exact comments to be posted)
|
|
201
|
-
## Confidence & Gaps
|
|
202
|
-
```
|
|
32
|
+
Recurring knowledge is optional and separately authorized from GitHub posting.
|
|
203
33
|
|
|
204
|
-
##
|
|
34
|
+
## Return
|
|
205
35
|
|
|
206
|
-
|
|
207
|
-
- **ONE `gh api` call to post the review** — batch all inline comments into the `comments[]` array; never loop and post per-finding; never mix `gh pr review` + `gh api` + `gh pr comment` in the same session
|
|
208
|
-
- Never auto-approve; approval only on explicit user override
|
|
209
|
-
- Never post to GitHub before user picks a posting mode
|
|
210
|
-
- Cite every finding — no uncited claims
|
|
211
|
-
- ` ```suggestion ` blocks only for small line-replacement fixes
|
|
212
|
-
- Defer to the tech-architect agent (structural audit) for full structural drift; surface as handoff flag, do not run inline
|
|
213
|
-
- Defer performance or incident investigation to the software-engineer agent with `AGENT_MODE: incident` and mandatory systematic-debugging; surface as a risk flag
|
|
214
|
-
- Review dimensions are defined in this skill (Adaptive Rubric); inline findings use the one-line format `<file>:L<line>: problem. fix.` — do not duplicate
|
|
215
|
-
- Re-review detection: if AI has reviewed before, scope to diff since last review's commit_id
|
|
216
|
-
- Tag each posted suggestion with `<!-- arcs:deep-review:<finding-id> -->` for re-review tracking
|
|
217
|
-
- See `review-template.md` for GitHub review body template
|
|
218
|
-
- See `codegraph-diff.md` for the changed-symbols-to-impact algorithm
|
|
36
|
+
Report scope, findings by severity, cleared risks, confidence/gaps, and the chosen posting result.
|
|
@@ -1,96 +1,10 @@
|
|
|
1
|
-
# Codegraph Diff
|
|
1
|
+
# Optional Codegraph Diff Analysis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use the cached PR diff from the parent review; never fetch a second diff.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
1. Extract changed symbols and files from the cached diff.
|
|
6
|
+
2. Query codegraph impact, callers, callees, or exploration only for material boundaries.
|
|
7
|
+
3. Check whether callers, public contracts, or high-coupling modules are omitted from tests or migration notes.
|
|
8
|
+
4. Return concise evidence-linked risks to the parent review.
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
which codegraph || echo "skip" # graceful absence
|
|
11
|
-
codegraph status --json 2>/dev/null # index must exist + be initialized
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
If codegraph is missing or the index is stale relative to the PR's base commit, refresh:
|
|
15
|
-
```bash
|
|
16
|
-
codegraph sync . # incremental; or `codegraph index . --force` for a full rebuild
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The index lives in `.codegraph/` (SQLite, gitignored) — there is no `graph.json` file.
|
|
20
|
-
|
|
21
|
-
## Step 1: Extract changed symbols from the diff
|
|
22
|
-
|
|
23
|
-
Parse the cached `DIFF` snapshot (optionally materialized as `/tmp/pr.diff`) to extract changed symbols:
|
|
24
|
-
- For each `+++ b/<file>` hunk, capture the file path
|
|
25
|
-
- For each added / modified function or exported identifier, capture `<symbol>` (codegraph addresses symbols by name, not `<file>::<symbol>`)
|
|
26
|
-
- Skip pure deletions (handled separately under "removed coupling" check)
|
|
27
|
-
|
|
28
|
-
Heuristic for symbol extraction (language-aware):
|
|
29
|
-
- TypeScript / JavaScript: `function X`, `class X`, `export const X`, `export function X`, `const X = `
|
|
30
|
-
- Python: `def X`, `class X`
|
|
31
|
-
- Go: `func X`, `type X`
|
|
32
|
-
- Rust: `fn X`, `struct X`, `impl X`
|
|
33
|
-
- Other: fall back to file-level granularity
|
|
34
|
-
|
|
35
|
-
## Step 2: Run `impact` per changed symbol
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
codegraph impact "<symbol>" --json # what code is affected by changing this symbol
|
|
39
|
-
codegraph callers "<symbol>" --json # direct callers (one hop)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`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.
|
|
43
|
-
|
|
44
|
-
Collect for each symbol:
|
|
45
|
-
- **Fan-out callers** — who depends on this symbol (changes ripple here), from `callers` / `impact`
|
|
46
|
-
- **Fan-out reach** — size of the impact set (proxy for blast radius)
|
|
47
|
-
- **Cross-module edges** — callers in different top-level dirs (derive from each caller's `file_path`)
|
|
48
|
-
|
|
49
|
-
## Step 3: Detect surprising fan-out
|
|
50
|
-
|
|
51
|
-
Flag as 🟠 **risk** in the report when:
|
|
52
|
-
|
|
53
|
-
| Pattern | Meaning |
|
|
54
|
-
|---------|---------|
|
|
55
|
-
| Changed symbol has >10 callers across >3 modules | Wide blast radius — non-obvious from diff alone |
|
|
56
|
-
| Changed signature on a symbol with >5 callers | Breaking-change risk |
|
|
57
|
-
| New symbol has same name as existing symbol in another module | Naming collision risk → DRY check |
|
|
58
|
-
|
|
59
|
-
## Step 4: Duplication check
|
|
60
|
-
|
|
61
|
-
For each new function added in the diff, run:
|
|
62
|
-
```bash
|
|
63
|
-
codegraph query "<new-symbol-name or signature keywords>" --json
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
`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.
|
|
67
|
-
|
|
68
|
-
## Step 5: Aggregate findings
|
|
69
|
-
|
|
70
|
-
Each codegraph-derived finding must include:
|
|
71
|
-
- The `codegraph` command that produced it (for reproducibility)
|
|
72
|
-
- The cited symbol(s) — use backticks
|
|
73
|
-
- The cited module path(s)
|
|
74
|
-
- A finding ID for re-review tracking: `<file>:<line>:<dimension>:<short-hash>`
|
|
75
|
-
|
|
76
|
-
## Performance bounds
|
|
77
|
-
|
|
78
|
-
- Cap symbols analyzed per PR at 50. If diff contains more, sample by:
|
|
79
|
-
- All exported / public symbols first (always)
|
|
80
|
-
- Then internal symbols by descending hunk size
|
|
81
|
-
- Skip step 4 (duplication) entirely if diff size exceeds 1500 LOC — too noisy
|
|
82
|
-
|
|
83
|
-
## Graceful degradation
|
|
84
|
-
|
|
85
|
-
If any codegraph call fails or returns empty:
|
|
86
|
-
- Note in report: `Codegraph step <N> unavailable: <reason>` under "Cleared Dimensions"
|
|
87
|
-
- Continue with the remaining dimensions
|
|
88
|
-
- Never let a codegraph failure abort the review
|
|
89
|
-
|
|
90
|
-
## Output integration
|
|
91
|
-
|
|
92
|
-
Codegraph findings flow back into the standard finding pipeline. Each one is:
|
|
93
|
-
- Cited as `codegraph: <one-line observation>`
|
|
94
|
-
- Severity-classified (most are 🟡 suggestion or 🟠 risk; rarely 🔴)
|
|
95
|
-
- Attached to a specific file+line if possible; otherwise lives in the top-level review body
|
|
96
|
-
- Tagged for re-review with `<!-- arcs:deep-review:<finding-id> -->`
|
|
10
|
+
Skip this analysis when the index is absent or the diff is local and obvious.
|
|
@@ -1,69 +1,22 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Used as the `body` field of `gh api repos/{owner}/{repo}/pulls/{pull_number}/reviews` when posting. Inline comments live in the `comments[]` array; this is the top-level summary.
|
|
4
|
-
|
|
5
|
-
## Template
|
|
1
|
+
# Deep PR Review Template
|
|
6
2
|
|
|
7
3
|
```markdown
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
**Scope:** <N files, +X/-Y LOC, modules: <list>>
|
|
11
|
-
**Rubric:** <activated dimensions> — others cleared (not applicable)
|
|
12
|
-
**Posting mode:** <1-Critical-only | 2-Critical+actionable | 3-All | 4-Summary>
|
|
13
|
-
|
|
14
|
-
### Summary
|
|
15
|
-
<1-3 sentences: overall shape of the PR, biggest concern, what's well done>
|
|
4
|
+
# Review: <repo>#<number> — <title>
|
|
16
5
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- 🟠 <count> risk(s)
|
|
20
|
-
- 🟡 <count> suggestion(s)
|
|
21
|
-
- 🔵 <count> nit(s)
|
|
22
|
-
- ❓ <count> question(s)
|
|
6
|
+
## Scope
|
|
7
|
+
<files, change size, important boundaries>
|
|
23
8
|
|
|
24
|
-
|
|
9
|
+
## Findings
|
|
10
|
+
- [severity] <file>:L<line> — <problem, consequence, fix>
|
|
25
11
|
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
- [tech-architect] <reason — e.g. crosses 3 modules, touches god node X>
|
|
29
|
-
- [software-engineer, AGENT_MODE: incident, systematic-debugging] <reason — e.g. new query in render path>
|
|
12
|
+
## Cleared Risks
|
|
13
|
+
- <dimension>: <evidence>
|
|
30
14
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- knowledge/<id> — <what was checked>
|
|
34
|
-
- codegraph — <observations, if run>
|
|
15
|
+
## Confidence and Gaps
|
|
16
|
+
<what was and was not verified>
|
|
35
17
|
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
## Posting
|
|
19
|
+
<mode and exact payload, or not posting>
|
|
38
20
|
```
|
|
39
21
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- **Posting mode** field is informational for the author — they see what severity threshold was applied
|
|
43
|
-
- Findings counts are **as posted**, not as found. Mode 1 with 4 nits found shows `🔵 0 nit(s)` — those were dropped
|
|
44
|
-
- Architectural / Performance Handoffs section is omitted entirely if no handoffs (don't show empty headings)
|
|
45
|
-
- The trailing HTML comment is mandatory — used by re-review detection to find prior AI reviews
|
|
46
|
-
|
|
47
|
-
## Inline comment template (per finding)
|
|
48
|
-
|
|
49
|
-
```markdown
|
|
50
|
-
<severity-emoji> <severity>: <one-line problem>. <one-line fix>.
|
|
51
|
-
|
|
52
|
-
<optional 1-2 sentences of why, only if not obvious from problem>
|
|
53
|
-
|
|
54
|
-
Citation: <AGENTS.md §x | knowledge/<id> | codegraph | principle: <name>>
|
|
55
|
-
|
|
56
|
-
```suggestion
|
|
57
|
-
<replacement code — only for small line replacements>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
<!-- arcs:deep-review:<finding-id> -->
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Approve-with-comments override
|
|
64
|
-
|
|
65
|
-
If the user explicitly says "approve" / "lgtm" / "post approve":
|
|
66
|
-
- Set `event: "APPROVE"` on the review API call
|
|
67
|
-
- Top-level body must still list any 🟡 / 🔵 findings as advisory notes
|
|
68
|
-
- Append to body: `**Approved with <N> non-blocking suggestion(s).**`
|
|
69
|
-
- Never auto-elevate to APPROVE without explicit user phrase
|
|
22
|
+
Escalate architecture questions to `tech-architect`. Escalate performance incidents to `software-engineer` incident work with `systematic-debugging`. Posting still requires explicit confirmation.
|
|
@@ -1,169 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: enriching-codegraph-proposals
|
|
3
|
-
description:
|
|
3
|
+
description: Triage pending codegraph proposals into useful project knowledge
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Enrich Codegraph Proposals
|
|
7
7
|
|
|
8
8
|
## When
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Use when init or codegraph sync reports `pending_enrichment: true`, or when the user asks to process the proposal queue.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
- `arcs codegraph-sync` returned `pending_enrichment: true`.
|
|
14
|
-
- User said "enrich the proposals", "process the codegraph queue", "promote the pending proposals", or similar.
|
|
12
|
+
## Method
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
1. Run `arcs proposal list <slug>`.
|
|
15
|
+
2. Inspect the proposal's structural facts, source files, and likely duplicates.
|
|
16
|
+
3. Choose **keep**, **merge**, or **drop**:
|
|
17
|
+
- keep a distinct useful boundary grounded in real code;
|
|
18
|
+
- merge when an existing entry is the right home and the proposal adds evidence;
|
|
19
|
+
- drop tests-only, docs-only, tiny, stale, duplicate, or unsupported noise.
|
|
20
|
+
4. For keep or merge, author a human title, concise impact summary, substantive body, and source files.
|
|
21
|
+
5. Apply the requested promote/drop operation and continue until the useful queue is handled.
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
Source files and structural evidence must support every promoted claim. Never invent responsibilities from names alone. Preserve proposal IDs and give a reason for drops. Cap source files to the most useful anchors when the raw list is large.
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
flowchart TD
|
|
22
|
-
classDef decision fill:#f59e0b,color:#fff
|
|
23
|
-
classDef terminal fill:#22c55e,color:#fff
|
|
25
|
+
Use `--body-file` for long bodies. Stop and report races or missing merge targets rather than silently changing the decision.
|
|
24
26
|
|
|
25
|
-
|
|
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[Propose drop command + 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[Propose merge command]
|
|
35
|
-
G --> K[Propose promote command]
|
|
36
|
-
F --> L{Budget left?}
|
|
37
|
-
J --> L
|
|
38
|
-
K --> L
|
|
39
|
-
L -->|Yes & proposals remain| C
|
|
40
|
-
L -->|No or empty| Done
|
|
27
|
+
## Return
|
|
41
28
|
|
|
42
|
-
|
|
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
|
-
Propose `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
|
-
Propose `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 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
|
-
|
|
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-triage early.** Proposing drops for obvious noise in one pass 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
|
-
| Proposed merge target no longer exists at apply time | Orchestrator rejects it; return for re-audit rather than changing the command during apply. |
|
|
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 disappears before return | Re-list read-only, omit it, and report the race. |
|
|
126
|
-
| Proposed entry would miss graph edges | Verify `--source-files` is present 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 proposed promote is one decision and one command. Bulk promotion bypasses dedup checks and per-proposal review.
|
|
136
|
-
- **Preserve proposal IDs in 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. PROPOSED_MUTATIONS: drop obvious noise
|
|
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. PROPOSED_MUTATIONS: 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. PROPOSED_MUTATIONS: 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
|
-
# Return these commands without executing them; the orchestrator applies approved mutations.
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Exit
|
|
168
|
-
|
|
169
|
-
Return `PROPOSED_MUTATIONS:` with one stable proposal ID, verdict, rationale, and exact command per item. Do not execute `arcs knowledge upsert` or proposal mutations. Surface a one-line summary to the orchestrator: proposed keeps N, merges M, drops K, deferred D.
|
|
29
|
+
Report counts and IDs for kept, merged, dropped, and deferred proposals, plus created or updated knowledge IDs.
|