一键导入
remy-insight
Deep repository analysis with multi-agent parallel perspectives. Requires /init + /remy-index as prerequisites. Produces structured research reports.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deep repository analysis with multi-agent parallel perspectives. Requires /init + /remy-index as prerequisites. Produces structured research reports.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Discover and run tests after code modification. Supports multi-angle defect prediction and coverage analysis. Recommended after large-scale edits or accumulated working tree changes.
Scan source files (Python, C/C++, TypeScript) and generate semantic logic index via LLM. Index is injected into CLAUDE.md and used by hooks/skills for dependency analysis. Run after repo init or major changes.
Diagnose bugs via hypothesis loop with circuit breaker. Diagnosis only — produces evidence packets for /remy-patch without modifying code.
Audit architecture for risks, side effects, and ambiguities before writing code. Produces evidence packets for /remy-patch. Recommended for large or complex tasks.
Verify code changes via Intent/Log/Code triangulation. Independent blind audit without prior session context. Paired with /remy-changelog: generate log, rewind context, then audit.
Analyze CI/CD failure logs to diagnose build, test, and gate failures. Supports GitHub Actions (gh CLI), local log files, and pasted logs. Produces evidence packets for /remy-patch.
| name | remy-insight |
| description | Deep repository analysis with multi-agent parallel perspectives. Requires /init + /remy-index as prerequisites. Produces structured research reports. |
| allowed-tools | Read, Grep, Glob, Bash, PowerShell, Write, AskUserQuestion, Agent |
| argument-hint | [global | focus <topic> [--with <section>] | compare <doc_path>] [--depth light|standard|deep] |
| disable-model-invocation | true |
Multi-dimensional, multi-agent deep semantic analysis skill. Consumes logic_index.db (SQLite) to analyze repository architecture, identify improvement opportunities, and verify documentation-code consistency.
Relationship to other skills:
| Skill | Relationship |
|---|---|
| remy-index | Data source. Insight consumes logic_index.db |
| remy-reposcout | Upstream. reposcout does shallow recon → user decides to clone → insight does deep research |
| remy-audit | No overlap. audit targets incremental diffs; insight targets whole-repo / focused research |
| remy-secure | Partial overlap (robustness dimension). insight gives high-level observation; secure does rule-driven scanning |
| Environment Variable | Default | Description |
|---|---|---|
INSIGHT_DEFAULT_DEPTH | standard | Depth level when --depth is not specified |
INSIGHT_MAX_CUSTOM_ANGLES | 2 | Maximum user-defined custom analysis angles |
INSIGHT_MAX_AGENTS | 40 | Hard cap on total agents per run (analysis + adversarial combined) |
Path Convention: All paths below are relative to
~/.claude/. UseRead("~/.claude/skills/remy-insight/...")to access them.
| File | Purpose |
|---|---|
skills/remy-insight/output_schema.json | Report output JSON Schema |
skills/remy-insight/schemas/agent_finding.json | Single agent output Schema |
skills/remy-insight/prompts/angle_architecture.md | Architecture quality assessment prompt |
skills/remy-insight/prompts/angle_improvement.md | Improvement opportunity identification prompt |
skills/remy-insight/prompts/angle_robustness.md | Security & robustness assessment prompt |
skills/remy-insight/prompts/angle_innovation.md | Technical innovation identification prompt |
skills/remy-insight/prompts/angle_custom.md | User-defined custom angle framework template |
skills/remy-insight/templates/_base.md.j2 | Report shell (metadata, section loop, methodology) |
skills/remy-insight/templates/section_executive.md.j2 | Executive Summary section |
skills/remy-insight/templates/section_architecture.md.j2 | Architecture analysis section |
skills/remy-insight/templates/section_innovation.md.j2 | Innovation analysis section |
skills/remy-insight/templates/section_improvement.md.j2 | Improvement roadmap section |
skills/remy-insight/templates/section_robustness.md.j2 | Robustness analysis section |
skills/remy-insight/templates/section_custom.md.j2 | Custom dimension section |
skills/remy-insight/render.py | Template rendering + section assembly + cross-reference annotation + CLI entry point |
render.py attempts import jinja2. If unavailable, all templates are rendered via built-in string formatting. Jinja2 can be installed via install.py (optional step).
/remy-insight [mode] [args...] [--depth light|standard|deep]
global → global modefocus → focus mode, second argument is <topic>. Optional --with <section_name> to append additional sections..md or .tex → compare modecompare → compare mode, second argument is <doc_path>AskUserQuestion to present available modes and let user choose. Do NOT guess intent.AskUserQuestion to present available modes with descriptions.| Mode | Default Sections | Description |
|---|---|---|
global | executive, architecture, innovation, improvement, robustness | Full repository analysis |
focus <topic> | executive, architecture, improvement | Focused module/subsystem analysis |
compare <doc_path> | executive, doc_consistency, architecture | Document vs code consistency check |
For focus mode, --with <section> appends additional sections (e.g., focus auth --with robustness).
| Depth | Analysis Agents | Multi-Instance | Adversarial Verification |
|---|---|---|---|
light | 2 (architecture + improvement only) | No | No |
standard | Per active section count (2-5) | No | Yes — single-refute per issue-severity finding |
deep | Per active section × 2-3 instances | Yes (2-3 per angle) | Yes — 3-vote per concern/issue finding (≥2 consensus adopts) |
Default depth: Read INSIGHT_DEFAULT_DEPTH from environment. Falls back to standard.
Execute all checks sequentially. HALT on any failure.
Run Bash("test -f CLAUDE.md && echo EXISTS || echo MISSING") (or PowerShell equivalent on Windows).
/init first." → HALT.Run Bash("test -f .claude/logic_index.db && echo EXISTS || echo MISSING").
AskUserQuestion:
"
.claude/logic_index.dbdoes not exist. Run/remy-indexto generate? This is required for remy-insight."
remy-index skill, then continue.Layer 1 — Dirty file tracker:
Check if .claude/logic_index_dirty exists and is non-empty.
DIRTY.Layer 2 — File set diff:
Glob the current source files matching parser extensions (.py, .c, .cpp, .h, .ts, .tsx). Compare against file paths from SELECT path FROM files in .claude/logic_index.db. Detect additions and deletions.
STALE_FILES.Layer 3 — Modification time sampling:
Query SELECT value FROM meta WHERE key='last_updated' from logic_index.db. For up to 10 randomly selected indexed files, compare file modification time (mtime) against last_updated. Use seconds-level precision for cross-platform compatibility.
STALE_MTIME.Decision:
AskUserQuestion:
"Logic index may be outdated: {flags}. Update now with
/remy-index?"
remy-index, then continue.Only for compare mode.
Read..md or single-file .tex (Batch 1 scope). Multi-file .tex with \input{} and .pdf are not supported in Batch 1.Phase 1 Exit: All prerequisites satisfied. Proceed to Phase 2.
Borrowing from remy-plan's loop-until-saturated mechanism.
For focus mode, resolve <topic> to a file set.
Hierarchical-Summary Path (primary): If remy-index MCP server is available and the file/cluster summary layer is bootstrapped:
query_navigate(intent=<topic>, top_k=10).file? paths from the ranked entries; if a ranked entry references only a cluster, expand it by reading the cluster's files via the SQL detail layer (step 1-2 of the SQL Keyword Path below) restricted to that cluster.edges table).query_navigate returns an empty result, an error, or MCP is unavailable, silently fall back to the SQL Keyword Path below — do NOT halt or warn the user.SQL Keyword Path (fallback):
.claude/logic_index.db via SQLite.<topic> keywords against:
Post-processing (common to both paths):
AskUserQuestion to ask user to specify files or directories.AskUserQuestion to ask user to narrow scope.LOOP:
1. Present to user:
- Mode: {mode}
- Depth: {depth}
- Active sections: {list with descriptions}
- Estimated agent count: {N analysis + M adversarial = total}
- Target files (focus mode): {count} files across {layers} layers
2. AskUserQuestion: "Proceed with this configuration?"
- Proceed → Break
- Modify sections → adjust active sections → re-present
- Change depth → adjust → re-present
- Add custom angle → collect user prompt → append → re-present
3. Check: total estimated agents ≤ INSIGHT_MAX_AGENTS
- Exceeds → warn user, suggest reducing depth or sections
Phase 2 Exit: Configuration locked. Proceed to Phase 3.
For each active section, prepare the agent's input context.
Hierarchical-Summary Overview (primary): If MCP is available, prefix each agent's logic_index context with a cluster-level overview obtained via query_cluster_summary. SQL Detail Layer (always): The detailed files / symbols / edges query continues to populate the symbol-level context as before.
query_cluster_summary() (no args) → record all cluster short and full summaries as the top-level overview text.files, symbol signatures from symbols, call graph from edges). Format as structured text.query_cluster_summary(name=<cluster>) → record the short and full summaries.edges table).query_cluster_summary() (no args) → record all cluster summaries.compare mode, the cluster overview text MUST be enclosed under a [Code-side Cluster Summary] section header, and the document content MUST be enclosed under a [Document Excerpt] section header. Both headers MUST appear exactly once. This prevents the LLM from confusing the doc anchor with the code-side cluster description.Fallback: If MCP is unavailable, or query_cluster_summary returns "No clusters found" / an error, silently skip the Overview step for the affected mode. The SQL Detail Layer continues unchanged. For compare mode, when the Overview is skipped, the [Code-side Cluster Summary] header MUST be omitted (the partition rule applies only when the overview content exists); the [Document Excerpt] header MUST still be present.
Read the relevant source files for the scope. For files > 500 lines, read only the symbol ranges from logic_index.
Phase 3.1 prepares the context variables. Phase 3.2 constructs and invokes a single Workflow call that orchestrates all analysis and adversarial agents.
Pre-dispatch preparation (executed in main session before Workflow call):
Read("~/.claude/skills/remy-insight/prompts/angle_{section_name}.md")Read("~/.claude/skills/remy-insight/schemas/agent_finding.json")claim and evidence fieldsargs to the Workflow.Workflow invocation: Call Workflow with the following script template. Replace {PLACEHOLDERS} with the actual values computed above.
export const meta = {
name: 'remy-insight-analysis',
description: 'Multi-agent repository analysis with adversarial verification',
phases: [
{ title: 'Analyze', detail: 'Parallel analysis agents per dimension' },
{ title: 'Dedup', detail: 'Deduplicate findings across agents' },
{ title: 'Verify', detail: 'Adversarial verification of concern/issue findings' },
],
}
const FINDING_SCHEMA = args.findingSchema
const SECTIONS = args.sections
const DEPTH = args.depth
const MAX_AGENTS = args.maxAgents
phase('Analyze')
const analysisResults = await parallel(
SECTIONS.map(section => () =>
agent(section.prompt, {
label: `analyze:${section.name}`,
phase: 'Analyze',
schema: FINDING_SCHEMA,
})
)
)
const validResults = analysisResults.filter(Boolean)
const analysisAgentCount = SECTIONS.length
if (validResults.length < Math.ceil(SECTIONS.length / 2)) {
return { error: true, reason: 'Over 50% of analysis agents failed', validCount: validResults.length, totalCount: SECTIONS.length }
}
const allFindings = []
const summaries = {}
const skippedSections = []
for (let i = 0; i < SECTIONS.length; i++) {
const result = analysisResults[i]
const sectionName = SECTIONS[i].name
if (!result) {
skippedSections.push({ name: sectionName, reason: 'agent error' })
continue
}
summaries[sectionName] = result.summary
for (const f of result.findings) {
allFindings.push(f)
}
}
phase('Dedup')
const dedupMap = {}
for (const f of allFindings) {
const key = (f.target.file || '') + '::' + (f.target.symbol || '')
const severityRank = { issue: 3, concern: 2, observation: 1 }
const existing = dedupMap[key]
if (!existing || (severityRank[f.severity] || 0) > (severityRank[existing.severity] || 0)) {
dedupMap[key] = f
}
}
const uniqueFindings = Object.values(dedupMap)
const issueFindings = uniqueFindings.filter(f => f.severity === 'issue')
const concernFindings = uniqueFindings.filter(f => f.severity === 'concern')
log(`Dedup: ${allFindings.length} → ${uniqueFindings.length} unique (${issueFindings.length} issue, ${concernFindings.length} concern)`)
if (DEPTH === 'light') {
for (const f of allFindings) { f.verified_status = 'not_verified' }
return { findings: allFindings, summaries, skippedSections, analysisAgentCount, adversarialAgentCount: 0 }
}
phase('Verify')
let remainingBudget = MAX_AGENTS - analysisAgentCount
let adversarialAgentCount = 0
const issueVerified = await parallel(
issueFindings.slice(0, Math.floor(remainingBudget / 3)).map(f => () => {
const votesNeeded = DEPTH === 'deep' ? 3 : 1
const votePromises = Array.from({ length: votesNeeded }, (_, vi) => () =>
agent(
`Attempt to REFUTE this finding. Provide evidence for or against.\n\nFinding: ${f.claim}\nEvidence: ${f.evidence}\nTarget: ${f.target.file} → ${f.target.symbol || '(module-level)'}\n\nOutput ONLY one of: refuted / upheld / inconclusive`,
{ label: `verify:issue:${f.id}:v${vi}`, phase: 'Verify' }
)
)
return parallel(votePromises).then(votes => {
const validVotes = votes.filter(Boolean).map(v => {
const t = (typeof v === 'string' ? v : '').toLowerCase()
if (t.includes('refuted')) return 'refuted'
if (t.includes('upheld')) return 'upheld'
return 'inconclusive'
})
const counts = { upheld: 0, refuted: 0, inconclusive: 0 }
for (const v of validVotes) counts[v]++
const verdict = counts.upheld >= 2 ? 'upheld' : counts.refuted >= 2 ? 'refuted' : 'inconclusive'
f.verified_status = verdict
f.vote_detail = `${counts.upheld} upheld / ${counts.refuted} refuted / ${counts.inconclusive} inconclusive`
return f
})
})
)
adversarialAgentCount += issueFindings.slice(0, Math.floor(remainingBudget / 3)).length * (DEPTH === 'deep' ? 3 : 1)
remainingBudget -= adversarialAgentCount
if (remainingBudget > 0 && concernFindings.length > 0) {
const concernSlice = concernFindings.slice(0, remainingBudget)
const concernVerified = await parallel(
concernSlice.map(f => () =>
agent(
`Attempt to REFUTE this finding. Provide evidence for or against.\n\nFinding: ${f.claim}\nEvidence: ${f.evidence}\nTarget: ${f.target.file} → ${f.target.symbol || '(module-level)'}\n\nOutput ONLY one of: refuted / upheld / inconclusive`,
{ label: `verify:concern:${f.id}`, phase: 'Verify' }
).then(v => {
const t = (typeof v === 'string' ? v : '').toLowerCase()
f.verified_status = t.includes('refuted') ? 'refuted' : t.includes('upheld') ? 'upheld' : 'inconclusive'
return f
})
)
)
adversarialAgentCount += concernSlice.length
}
for (const f of allFindings) {
if (!f.verified_status) f.verified_status = 'not_verified'
}
return { findings: allFindings, summaries, skippedSections, analysisAgentCount, adversarialAgentCount }
Workflow args structure — constructed by the main session and passed verbatim:
{
"findingSchema": <contents of agent_finding.json>,
"sections": [
{"name": "architecture", "prompt": "<full constructed prompt>"},
{"name": "innovation", "prompt": "<full constructed prompt>"}
],
"depth": "standard",
"maxAgents": 40
}
Mode dispatch rules (determine the sections array content):
[BIAS: conservative-assessment], [BIAS: aggressive-assessment], [BIAS: devil-advocate]).innovation dimension with sub-angle sets, expand into sub-angle × bias entries. Each entry's prompt has {sub_angle_instructions} replaced with the sub-angle focus block.Default sub-angle sets (fixed, not user-configurable):
| Dimension | Sub-Angle | Focus |
|---|---|---|
innovation | algorithm | Algorithms, mathematical techniques, complexity analysis, SOTA comparison |
innovation | architecture | Non-conventional architectural choices, engineering constraints and trade-offs |
innovation | limitation | Technical boundaries, degradation scenarios, unexplored directions |
Sub-angle injection (Mode C only):
Replace {sub_angle_instructions} in the prompt template with:
## Sub-Angle Focus: {sub_angle_name}
For this analysis, focus specifically on: {sub_angle_focus_description}
Prioritize findings within this sub-angle. You may still report findings outside this sub-angle if they are severity "issue", but allocate at least 80% of your findings budget to the specified focus area.
Dimensions without sub-angle sets (architecture, improvement, robustness, custom) replace {sub_angle_instructions} with an empty string and use Mode B unchanged.
Agent count: Total sections array length. Check against INSIGHT_MAX_AGENTS before invoking Workflow. If exceeded, warn user and suggest reducing depth or sections.
If the Workflow call returns an error (script error, timeout, or returns {error: true}):
Adversarial verification is embedded within the Workflow script (see Phase 3.2). The Workflow handles it in its Verify phase.
Dedup-then-verify strategy:
After all analysis agents return, the Workflow deduplicates findings by target.file + target.symbol exact match before verification. When multiple findings share the same target, the one with highest severity is retained as the representative. This reduces the verification target count (observed ~50-65% reduction in testing).
Dynamic budget allocation:
remaining_budget = INSIGHT_MAX_AGENTS - analysis_agent_count.verified_status: "not_verified".Verification modes by depth:
| Depth | issue findings | concern findings | observation findings |
|---|---|---|---|
light | not_verified | not_verified | not_verified |
standard | 1-vote refute | not_verified | not_verified |
deep | 3-vote consensus (≥2 agrees) | 1-vote refute (budget permitting) | not_verified |
Consensus rule (deep mode, issue findings): ≥2 of 3 votes agree → adopt that verdict. Otherwise → inconclusive.
The Workflow returns a structured JavaScript object. The main session processes it as follows:
{error: true}, follow Phase 3.3 (HALT).findings — flat array of all findings (with verified_status already set by the Workflow)summaries — per-section summary textsskippedSections — sections that failed during analysisanalysisAgentCount — number of analysis agents usedadversarialAgentCount — number of adversarial agents usedmkdir -p ".claude/temp_insight" (or PowerShell equivalent).claude/temp_insight/raw_findings_full.json:{
"mode": "<mode>",
"depth": "<depth>",
"dimensions": ["<active section names>"],
"total_findings": <N>,
"findings_by_severity": {"issue": <n>, "concern": <n>, "observation": <n>},
"summaries": {"<section_name>": "<summary text>", ...},
"agent_count": {"analysis": <n>, "adversarial": <n>, "total": <n>},
"adversarial_results": {"verified_count": <n>, "upheld": <n>, "refuted": <n>, "inconclusive": <n>},
"scope_description": "<human-readable scope>",
"freshness_warnings": [],
"skipped_sections": [],
"findings": [<flat array from Workflow return>]
}
Count findings_by_severity and adversarial_results by iterating the findings array in the main session. The timestamp field is generated in the main session (Workflow scripts cannot call Date.now()).
Invoke render.py to generate the final Markdown report:
python "~/.claude/skills/remy-insight/render.py" \
--input ".claude/temp_insight/raw_findings_full.json" \
--output ".claude/temp_insight/insight_{timestamp}.md"
render.py performs:
dimension field into per-section bucketsinnovation section: renders mechanism and significance fields as expanded blocks_base.md.j2Do NOT hand-assemble the report in the conversation. Always use render.py.
Skill terminates after report output. Users may continue discussion in the main conversation using the report as context.
| Section Name | Angle Prompt File | Description |
|---|---|---|
architecture | angle_architecture.md | Module boundaries, coupling, cohesion, dependency direction |
innovation | angle_innovation.md | Novel algorithms, design patterns, unique approaches. Supports {sub_angle_instructions} placeholder for focus×deep sub-angle injection |
improvement | angle_improvement.md | Refactoring candidates, missing abstractions, performance bottlenecks |
robustness | angle_robustness.md | Error handling gaps, resource leaks, concurrency hazards |
doc_consistency | (inline in Phase 3) | Document claims vs code implementation verification |
custom | angle_custom.md | User-defined analysis dimension with {user_focus} placeholder |
The following features are planned for Batch 2 and are NOT implemented in this version:
.pdf support and multi-file .tex with \input{} recursion