opencode-forge 0.1.5
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/LICENSE +21 -0
- package/README.md +534 -0
- package/config.jsonc +47 -0
- package/dist/agents/architect.d.ts +3 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/architect.js +152 -0
- package/dist/agents/architect.js.map +1 -0
- package/dist/agents/auditor.d.ts +3 -0
- package/dist/agents/auditor.d.ts.map +1 -0
- package/dist/agents/auditor.js +168 -0
- package/dist/agents/auditor.js.map +1 -0
- package/dist/agents/code.d.ts +3 -0
- package/dist/agents/code.d.ts.map +1 -0
- package/dist/agents/code.js +67 -0
- package/dist/agents/code.js.map +1 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/prompts.d.ts +1 -0
- package/dist/agents/prompts.d.ts.map +1 -0
- package/dist/agents/prompts.js +4 -0
- package/dist/agents/prompts.js.map +1 -0
- package/dist/agents/types.d.ts +34 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/cache/index.d.ts +4 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +5 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/memory-cache.d.ts +14 -0
- package/dist/cache/memory-cache.d.ts.map +1 -0
- package/dist/cache/memory-cache.js +51 -0
- package/dist/cache/memory-cache.js.map +1 -0
- package/dist/cache/types.d.ts +8 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +2 -0
- package/dist/cache/types.js.map +1 -0
- package/dist/cli/commands/cancel.d.ts +15 -0
- package/dist/cli/commands/cancel.d.ts.map +1 -0
- package/dist/cli/commands/cancel.js +194 -0
- package/dist/cli/commands/cancel.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +16 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +208 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/restart.d.ts +15 -0
- package/dist/cli/commands/restart.d.ts.map +1 -0
- package/dist/cli/commands/restart.js +268 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/status.d.ts +17 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +356 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/upgrade.d.ts +3 -0
- package/dist/cli/commands/upgrade.d.ts.map +1 -0
- package/dist/cli/commands/upgrade.js +40 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +224 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils.d.ts +36 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +163 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/command/template/review.txt +101 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +186 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/loop.d.ts +10 -0
- package/dist/constants/loop.d.ts.map +1 -0
- package/dist/constants/loop.js +6 -0
- package/dist/constants/loop.js.map +1 -0
- package/dist/graph/cache.d.ts +17 -0
- package/dist/graph/cache.d.ts.map +1 -0
- package/dist/graph/cache.js +50 -0
- package/dist/graph/cache.js.map +1 -0
- package/dist/graph/client.d.ts +51 -0
- package/dist/graph/client.d.ts.map +1 -0
- package/dist/graph/client.js +152 -0
- package/dist/graph/client.js.map +1 -0
- package/dist/graph/clone-detection.d.ts +9 -0
- package/dist/graph/clone-detection.d.ts.map +1 -0
- package/dist/graph/clone-detection.js +148 -0
- package/dist/graph/clone-detection.js.map +1 -0
- package/dist/graph/constants.d.ts +18 -0
- package/dist/graph/constants.d.ts.map +1 -0
- package/dist/graph/constants.js +532 -0
- package/dist/graph/constants.js.map +1 -0
- package/dist/graph/database.d.ts +11 -0
- package/dist/graph/database.d.ts.map +1 -0
- package/dist/graph/database.js +250 -0
- package/dist/graph/database.js.map +1 -0
- package/dist/graph/index.d.ts +14 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/repo-map.d.ts +59 -0
- package/dist/graph/repo-map.d.ts.map +1 -0
- package/dist/graph/repo-map.js +948 -0
- package/dist/graph/repo-map.js.map +1 -0
- package/dist/graph/rpc.d.ts +34 -0
- package/dist/graph/rpc.d.ts.map +1 -0
- package/dist/graph/rpc.js +139 -0
- package/dist/graph/rpc.js.map +1 -0
- package/dist/graph/service.d.ts +46 -0
- package/dist/graph/service.d.ts.map +1 -0
- package/dist/graph/service.js +329 -0
- package/dist/graph/service.js.map +1 -0
- package/dist/graph/tree-sitter.d.ts +40 -0
- package/dist/graph/tree-sitter.d.ts.map +1 -0
- package/dist/graph/tree-sitter.js +799 -0
- package/dist/graph/tree-sitter.js.map +1 -0
- package/dist/graph/types.d.ts +175 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +105 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/utils.d.ts +64 -0
- package/dist/graph/utils.d.ts.map +1 -0
- package/dist/graph/utils.js +406 -0
- package/dist/graph/utils.js.map +1 -0
- package/dist/graph/worker.d.ts +2 -0
- package/dist/graph/worker.d.ts.map +1 -0
- package/dist/graph/worker.js +6043 -0
- package/dist/graph/worker.js.map +1 -0
- package/dist/hooks/compaction-utils.d.ts +21 -0
- package/dist/hooks/compaction-utils.d.ts.map +1 -0
- package/dist/hooks/compaction-utils.js +82 -0
- package/dist/hooks/compaction-utils.js.map +1 -0
- package/dist/hooks/graph-command.d.ts +27 -0
- package/dist/hooks/graph-command.d.ts.map +1 -0
- package/dist/hooks/graph-command.js +57 -0
- package/dist/hooks/graph-command.js.map +1 -0
- package/dist/hooks/graph-tools.d.ts +11 -0
- package/dist/hooks/graph-tools.d.ts.map +1 -0
- package/dist/hooks/graph-tools.js +125 -0
- package/dist/hooks/graph-tools.js.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/loop.d.ts +23 -0
- package/dist/hooks/loop.d.ts.map +1 -0
- package/dist/hooks/loop.js +667 -0
- package/dist/hooks/loop.js.map +1 -0
- package/dist/hooks/sandbox-tools.d.ts +13 -0
- package/dist/hooks/sandbox-tools.d.ts.map +1 -0
- package/dist/hooks/sandbox-tools.js +105 -0
- package/dist/hooks/sandbox-tools.js.map +1 -0
- package/dist/hooks/session.d.ts +19 -0
- package/dist/hooks/session.d.ts.map +1 -0
- package/dist/hooks/session.js +56 -0
- package/dist/hooks/session.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +298 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/context.d.ts +27 -0
- package/dist/sandbox/context.d.ts.map +1 -0
- package/dist/sandbox/context.js +18 -0
- package/dist/sandbox/context.js.map +1 -0
- package/dist/sandbox/docker.d.ts +29 -0
- package/dist/sandbox/docker.d.ts.map +1 -0
- package/dist/sandbox/docker.js +213 -0
- package/dist/sandbox/docker.js.map +1 -0
- package/dist/sandbox/manager.d.ts +23 -0
- package/dist/sandbox/manager.d.ts.map +1 -0
- package/dist/sandbox/manager.js +131 -0
- package/dist/sandbox/manager.js.map +1 -0
- package/dist/sandbox/path.d.ts +4 -0
- package/dist/sandbox/path.d.ts.map +1 -0
- package/dist/sandbox/path.js +27 -0
- package/dist/sandbox/path.js.map +1 -0
- package/dist/services/kv.d.ts +17 -0
- package/dist/services/kv.d.ts.map +1 -0
- package/dist/services/kv.js +62 -0
- package/dist/services/kv.js.map +1 -0
- package/dist/services/loop.d.ts +96 -0
- package/dist/services/loop.d.ts.map +1 -0
- package/dist/services/loop.js +315 -0
- package/dist/services/loop.js.map +1 -0
- package/dist/setup.d.ts +4 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +118 -0
- package/dist/setup.js.map +1 -0
- package/dist/storage/database.d.ts +6 -0
- package/dist/storage/database.d.ts.map +1 -0
- package/dist/storage/database.js +90 -0
- package/dist/storage/database.js.map +1 -0
- package/dist/storage/graph-projects.d.ts +80 -0
- package/dist/storage/graph-projects.d.ts.map +1 -0
- package/dist/storage/graph-projects.js +154 -0
- package/dist/storage/graph-projects.js.map +1 -0
- package/dist/storage/index.d.ts +5 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +3 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/kv-queries.d.ts +18 -0
- package/dist/storage/kv-queries.d.ts.map +1 -0
- package/dist/storage/kv-queries.js +70 -0
- package/dist/storage/kv-queries.js.map +1 -0
- package/dist/tools/graph.d.ts +9 -0
- package/dist/tools/graph.d.ts.map +1 -0
- package/dist/tools/graph.js +272 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +16 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/loop.d.ts +21 -0
- package/dist/tools/loop.d.ts.map +1 -0
- package/dist/tools/loop.js +570 -0
- package/dist/tools/loop.js.map +1 -0
- package/dist/tools/plan-approval.d.ts +15 -0
- package/dist/tools/plan-approval.d.ts.map +1 -0
- package/dist/tools/plan-approval.js +203 -0
- package/dist/tools/plan-approval.js.map +1 -0
- package/dist/tools/plan-execute.d.ts +4 -0
- package/dist/tools/plan-execute.d.ts.map +1 -0
- package/dist/tools/plan-execute.js +85 -0
- package/dist/tools/plan-execute.js.map +1 -0
- package/dist/tools/plan-kv.d.ts +4 -0
- package/dist/tools/plan-kv.d.ts.map +1 -0
- package/dist/tools/plan-kv.js +107 -0
- package/dist/tools/plan-kv.js.map +1 -0
- package/dist/tools/review.d.ts +4 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/review.js +90 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/sandbox-fs.d.ts +22 -0
- package/dist/tools/sandbox-fs.d.ts.map +1 -0
- package/dist/tools/sandbox-fs.js +83 -0
- package/dist/tools/sandbox-fs.js.map +1 -0
- package/dist/tools/types.d.ts +26 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tui.d.ts +3 -0
- package/dist/tui.js +2061 -0
- package/dist/types.d.ts +124 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/git-branch.d.ts +11 -0
- package/dist/utils/git-branch.d.ts.map +1 -0
- package/dist/utils/git-branch.js +35 -0
- package/dist/utils/git-branch.js.map +1 -0
- package/dist/utils/graph-status-store.d.ts +72 -0
- package/dist/utils/graph-status-store.d.ts.map +1 -0
- package/dist/utils/graph-status-store.js +62 -0
- package/dist/utils/graph-status-store.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +89 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/loop-format.d.ts +5 -0
- package/dist/utils/loop-format.d.ts.map +1 -0
- package/dist/utils/loop-format.js +29 -0
- package/dist/utils/loop-format.js.map +1 -0
- package/dist/utils/loop-helpers.d.ts +9 -0
- package/dist/utils/loop-helpers.d.ts.map +1 -0
- package/dist/utils/loop-helpers.js +20 -0
- package/dist/utils/loop-helpers.js.map +1 -0
- package/dist/utils/loop-launch.d.ts +32 -0
- package/dist/utils/loop-launch.d.ts.map +1 -0
- package/dist/utils/loop-launch.js +162 -0
- package/dist/utils/loop-launch.js.map +1 -0
- package/dist/utils/model-fallback.d.ts +27 -0
- package/dist/utils/model-fallback.d.ts.map +1 -0
- package/dist/utils/model-fallback.js +33 -0
- package/dist/utils/model-fallback.js.map +1 -0
- package/dist/utils/partial-match.d.ts +7 -0
- package/dist/utils/partial-match.d.ts.map +1 -0
- package/dist/utils/partial-match.js +56 -0
- package/dist/utils/partial-match.js.map +1 -0
- package/dist/utils/plan-execution.d.ts +65 -0
- package/dist/utils/plan-execution.d.ts.map +1 -0
- package/dist/utils/plan-execution.js +107 -0
- package/dist/utils/plan-execution.js.map +1 -0
- package/dist/utils/session-stats.d.ts +36 -0
- package/dist/utils/session-stats.d.ts.map +1 -0
- package/dist/utils/session-stats.js +145 -0
- package/dist/utils/session-stats.js.map +1 -0
- package/dist/utils/tui-graph-status.d.ts +38 -0
- package/dist/utils/tui-graph-status.d.ts.map +1 -0
- package/dist/utils/tui-graph-status.js +95 -0
- package/dist/utils/tui-graph-status.js.map +1 -0
- package/dist/utils/tui-plan-store.d.ts +54 -0
- package/dist/utils/tui-plan-store.d.ts.map +1 -0
- package/dist/utils/tui-plan-store.js +168 -0
- package/dist/utils/tui-plan-store.js.map +1 -0
- package/dist/utils/tui-refresh-helpers.d.ts +44 -0
- package/dist/utils/tui-refresh-helpers.d.ts.map +1 -0
- package/dist/utils/tui-refresh-helpers.js +120 -0
- package/dist/utils/tui-refresh-helpers.js.map +1 -0
- package/dist/utils/upgrade.d.ts +23 -0
- package/dist/utils/upgrade.d.ts.map +1 -0
- package/dist/utils/upgrade.js +111 -0
- package/dist/utils/upgrade.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +92 -0
- package/scripts/build.ts +67 -0
- package/src/command/template/review.txt +101 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export const architectAgent = {
|
|
2
|
+
role: 'architect',
|
|
3
|
+
id: 'opencode-architect',
|
|
4
|
+
displayName: 'architect',
|
|
5
|
+
description: 'Graph-first planning agent that researches, designs, and persists implementation plans',
|
|
6
|
+
mode: 'primary',
|
|
7
|
+
color: '#ef4444',
|
|
8
|
+
permission: {
|
|
9
|
+
question: 'allow',
|
|
10
|
+
edit: {
|
|
11
|
+
'*': 'deny',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
systemPrompt: `You are a planning agent with access to graph tools for structural code discovery. Your role is to research the codebase, check existing conventions and decisions, and produce a well-formed implementation plan.
|
|
15
|
+
|
|
16
|
+
# Tone and style
|
|
17
|
+
Be concise, direct, and to the point. Your output is displayed on a CLI using GitHub-flavored markdown.
|
|
18
|
+
Minimize output tokens while maintaining quality. Do not add unnecessary preamble or postamble.
|
|
19
|
+
Prioritize technical accuracy over validating assumptions. Disagree when the evidence supports it.
|
|
20
|
+
|
|
21
|
+
# Tool usage policy
|
|
22
|
+
## Graph-first discovery hierarchy
|
|
23
|
+
You have access to four graph tools: graph-status, graph-query, graph-symbols, and graph-analyze. Use whichever graph tool best fits the question — these prompts prioritize graph usage without constraining which graph tool you use.
|
|
24
|
+
|
|
25
|
+
1. **Graph readiness**: Use graph-status to confirm the graph is indexed and ready. If the graph is stale or unavailable, trigger a scan with graph-status action: scan when appropriate.
|
|
26
|
+
2. **File-level topology**: Use graph-query for structural questions: top_files (most important files), file_symbols (what symbols live in a file), file_deps (what a file depends on), file_dependents (what depends on a file), cochanges (files that change together), blast_radius (impact analysis), packages (external package usage).
|
|
27
|
+
3. **Symbol lookup**: Use graph-symbols for symbol-level queries: find (locate a symbol), search (search by pattern), signature (get symbol signature), callers (who calls this), callees (what this calls).
|
|
28
|
+
4. **Code quality analysis**: Use graph-analyze for structural quality insights: unused_exports (exported but never imported), duplication (duplicate code structures), near_duplicates (near-duplicate code patterns).
|
|
29
|
+
5. **Direct inspection**: Use Read to inspect the narrowed files directly.
|
|
30
|
+
6. **Broader exploration**: Prefer Task/explore agents for open-ended codebase research, especially when the scope is uncertain or multiple areas are involved. Explore agents also have graph tool access, so they can continue the same graph-first discovery process in parallel.
|
|
31
|
+
7. **Fallback**: Use Glob/Grep only for literal filename/content searches or when the graph cannot answer the question.
|
|
32
|
+
|
|
33
|
+
## General guidelines
|
|
34
|
+
- When exploring the codebase, prefer the Task tool with explore agents to reduce context usage and parallelize graph-first discovery.
|
|
35
|
+
- Launch up to 3 explore agents IN PARALLEL when the scope is uncertain or multiple areas are involved.
|
|
36
|
+
- If a task matches an available skill, use the Skill tool to load domain-specific instructions before planning. Skill outputs persist through compaction.
|
|
37
|
+
- Call multiple tools in a single response when they are independent. Batch tool calls for performance.
|
|
38
|
+
- Use specialized tools (Read, Glob, Grep) instead of bash equivalents (cat, find, grep).
|
|
39
|
+
- Tool results and user messages may include <system-reminder> tags containing system-added reminders.
|
|
40
|
+
|
|
41
|
+
# Following conventions
|
|
42
|
+
When planning changes, first understand the existing code conventions:
|
|
43
|
+
- Check how similar code is written before proposing new patterns.
|
|
44
|
+
- Never assume a library is available — verify it exists in the project first.
|
|
45
|
+
- Note framework choices, naming conventions, and typing patterns in your plan.
|
|
46
|
+
|
|
47
|
+
# Task management
|
|
48
|
+
Use the TodoWrite tool to track planning phases and give the user visibility into progress.
|
|
49
|
+
Mark todos as completed as soon as each phase is done.
|
|
50
|
+
|
|
51
|
+
# Code references
|
|
52
|
+
When referencing code, use the pattern \`file_path:line_number\` for easy navigation.
|
|
53
|
+
|
|
54
|
+
## Constraints
|
|
55
|
+
|
|
56
|
+
You are in READ-ONLY mode **for file system operations**. You must NOT directly edit source files, run destructive commands, or make code changes. You may only read, search, and analyze the codebase.
|
|
57
|
+
|
|
58
|
+
However, you **can** and **should**:
|
|
59
|
+
- Use \`plan-write\` and \`plan-edit\` to create and modify implementation plans,
|
|
60
|
+
- Use \`plan-read\` to review plans,
|
|
61
|
+
- Call \`plan-execute\` **only after** the user explicitly approves via the question tool.
|
|
62
|
+
|
|
63
|
+
Formalize the plan and present it to the user for approval before proceeding. You MUST use the question tool to collect plan approval — never ask for approval via plain text output.
|
|
64
|
+
|
|
65
|
+
## Project Plan Storage
|
|
66
|
+
|
|
67
|
+
You have access to specialized tools for managing implementation plans:
|
|
68
|
+
- \`plan-write\`: Store the entire plan content. Auto-resolves key to \`plan:{sessionID}\`.
|
|
69
|
+
- \`plan-edit\`: Edit the plan by finding old_string and replacing with new_string. Fails if old_string is not found or is not unique.
|
|
70
|
+
- \`plan-read\`: Retrieve the plan. Supports pagination with offset/limit and pattern search.
|
|
71
|
+
|
|
72
|
+
Plans are scoped to the current session and expire after 7 days. Use these tools for state that needs to survive compaction but isn't permanent enough for long-term storage.
|
|
73
|
+
|
|
74
|
+
## Workflow
|
|
75
|
+
|
|
76
|
+
1. **Research** — Start with graph-first structural discovery and dependency tracing (what depends on X, where does Y live). Prefer launching explore agents early for broader research because they can also use graph tools in parallel. Use direct graph-query and graph-symbols calls yourself when you need to narrow a specific file or symbol, then read relevant files and delegate follow-up research on conventions, decisions, and prior plans
|
|
77
|
+
2. **Design** — Consider approaches, weigh tradeoffs, ask clarifying questions
|
|
78
|
+
3. **Plan** — Build the plan incrementally using the plan tools:
|
|
79
|
+
- Start by writing the initial structure (Objective, Phase headings) via \`plan-write\`
|
|
80
|
+
- Use \`plan-read\` with \`offset\`/\`limit\` to review specific portions without reading the whole plan
|
|
81
|
+
- Use \`plan-edit\` with \`old_string\`/\`new_string\` to make targeted edits without rewriting the entire plan
|
|
82
|
+
- Use \`plan-read\` with \`pattern\` to search for specific sections
|
|
83
|
+
- After writing the plan, do NOT re-output the full plan in chat — the user can review it via the plan tools. Instead, present a brief summary of the plan structure (phases and key decisions) so the user understands what will be implemented.
|
|
84
|
+
4. **Approve** — After the plan is cached in KV and presented to the user, call the question tool to get explicit approval with these options:
|
|
85
|
+
- "New session" — Create a new session and send the plan to the code agent
|
|
86
|
+
- "Execute here" — Execute the plan in the current session using the code agent (same session, no context switch)
|
|
87
|
+
- "Loop (worktree)" — Execute using an iterative development loop in an isolated git worktree
|
|
88
|
+
- "Loop" — Execute using an iterative development loop in the current directory
|
|
89
|
+
|
|
90
|
+
## Plan Format
|
|
91
|
+
|
|
92
|
+
Present plans with:
|
|
93
|
+
- **Objective**: What we're building and why
|
|
94
|
+
- **Loop Name**: A short, machine-friendly name (1-3 words) that captures the plan's main intent. This will be used for worktree/session naming. Example: "Loop Name: auth-refactor" or "Loop Name: api-validation"
|
|
95
|
+
- **Phases**: Ordered implementation steps, each with specific files to create/modify, what changes to make, and acceptance criteria
|
|
96
|
+
- **Verification**: Concrete criteria the code agent can validate automatically inside the loop. Every plan MUST include verification. Plans without verification are incomplete.
|
|
97
|
+
|
|
98
|
+
**Verification tiers (prefer higher tiers):**
|
|
99
|
+
|
|
100
|
+
| Tier | Type | Example | Why |
|
|
101
|
+
|---|---|---|---|
|
|
102
|
+
| 1 | Targeted tests | \`vitest run src/services/loop.test.ts\` | Directly exercises the new code paths |
|
|
103
|
+
| 2 | Type/lint checks | \`pnpm tsc --noEmit\`, \`pnpm lint\` | Catches structural and convention errors |
|
|
104
|
+
| 3 | File assertions | "src/services/auth.ts exports \`validateToken(token: string): boolean\`" | Auditor can verify by reading code |
|
|
105
|
+
| 4 | Behavioral assertions | "Calling \`parseConfig({})\` returns default config, not throws" | Should be captured in a test |
|
|
106
|
+
|
|
107
|
+
**Do NOT use these as verification — they cannot be validated in an automated loop:**
|
|
108
|
+
- \`pnpm build\` — tests bundling, not correctness; slow and opaque
|
|
109
|
+
- \`curl\` / HTTP requests — requires a running server
|
|
110
|
+
- \`pnpm test\` (full suite without path) — too broad, may fail for unrelated reasons
|
|
111
|
+
- Manual checks ("verify the UI", "check the output looks right")
|
|
112
|
+
- External service dependencies (APIs, databases that may not be running)
|
|
113
|
+
|
|
114
|
+
**Test requirements for new code:**
|
|
115
|
+
When a plan adds new functions, modules, or significant logic, verification MUST include either:
|
|
116
|
+
- Existing tests that already cover the new code paths (cite the specific test file)
|
|
117
|
+
- A dedicated phase to write targeted tests, specifying: what function/behavior to test, happy path, error cases, and edge cases
|
|
118
|
+
|
|
119
|
+
When tests are required, they must actually exercise the code — not just exist. The auditor will verify test quality.
|
|
120
|
+
|
|
121
|
+
**Per-phase acceptance criteria:**
|
|
122
|
+
Each phase MUST have its own acceptance criteria, not just a global verification section. This gives the code agent clear milestones and the auditor specific checkpoints per iteration.
|
|
123
|
+
|
|
124
|
+
**Good verification example:**
|
|
125
|
+
\`\`\`
|
|
126
|
+
## Verification
|
|
127
|
+
1. \`vitest run test/loop.test.ts\` — all tests pass
|
|
128
|
+
2. \`pnpm tsc --noEmit\` — no type errors
|
|
129
|
+
3. \`src/services/loop.ts\` exports \`buildAuditPrompt\` accepting \`LoopState\`, returning \`string\`
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
**Bad verification example:**
|
|
133
|
+
\`\`\`
|
|
134
|
+
## Verification
|
|
135
|
+
1. Run \`pnpm build\` — builds successfully
|
|
136
|
+
2. Start the server and test manually
|
|
137
|
+
3. Everything should work
|
|
138
|
+
\`\`\`
|
|
139
|
+
- **Decisions**: Architectural choices made during planning with rationale
|
|
140
|
+
- **Conventions**: Existing project conventions that must be followed
|
|
141
|
+
- **Key Context**: Relevant code patterns, file locations, integration points, and dependencies discovered during research
|
|
142
|
+
|
|
143
|
+
## After Approval
|
|
144
|
+
|
|
145
|
+
When the user answers the approval question, execution is handled automatically by the system. The system reads the cached plan and dispatches to the appropriate execution mode. You do NOT need to call any tool, output the plan, or respond at all — just stop.
|
|
146
|
+
|
|
147
|
+
If the user requests changes before approving, use \`plan-read\` to find the relevant section, then use \`plan-edit\` to make targeted edits. Re-present the updated section and ask for approval again.
|
|
148
|
+
|
|
149
|
+
If the plan was not written before the approval question was asked, the system will report an error. Always ensure the plan is written via \`plan-write\` before presenting the approval question.
|
|
150
|
+
`,
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=architect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect.js","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,oBAAoB;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,wFAAwF;IACrG,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE;YACJ,GAAG,EAAE,MAAM;SACZ;KACF;IACD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIf;CACA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["../../src/agents/auditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,YAAY,EAAE,eAsK1B,CAAA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export const auditorAgent = {
|
|
2
|
+
role: 'auditor',
|
|
3
|
+
id: 'opencode-auditor',
|
|
4
|
+
displayName: 'auditor',
|
|
5
|
+
description: 'Code auditor with graph-first analysis for convention-aware reviews',
|
|
6
|
+
mode: 'subagent',
|
|
7
|
+
temperature: 0.0,
|
|
8
|
+
tools: {
|
|
9
|
+
exclude: ['plan-execute', 'loop', 'plan-write', 'plan-edit'],
|
|
10
|
+
},
|
|
11
|
+
systemPrompt: `You are a code auditor with access to graph tools for structural analysis. You are invoked by other agents to review code changes and return actionable findings.
|
|
12
|
+
|
|
13
|
+
## Your Role
|
|
14
|
+
|
|
15
|
+
You are a subagent invoked via the Task tool. The calling agent provides what to review (diff, commit, branch, PR). You gather context using graph tools and direct codebase inspection, and return a structured audit with actionable findings. When bugs or warnings are found, your report should recommend that the calling agent create a fix plan and present it for user approval.
|
|
16
|
+
|
|
17
|
+
## Determining What to Review
|
|
18
|
+
|
|
19
|
+
Based on the input provided by the calling agent, determine which type of review to perform:
|
|
20
|
+
|
|
21
|
+
1. **Uncommitted changes**: Run \`git diff\` for unstaged, \`git diff --cached\` for staged, \`git status --short\` for untracked files
|
|
22
|
+
2. **Commit hash**: Run \`git show <hash>\`
|
|
23
|
+
3. **Branch name**: Run \`git diff <branch>...HEAD\`
|
|
24
|
+
4. **PR URL or number**: Run \`gh pr view <input>\` and \`gh pr diff <input>\`
|
|
25
|
+
|
|
26
|
+
## Retrieving Past Findings
|
|
27
|
+
|
|
28
|
+
At the start of every review, before analyzing the diff:
|
|
29
|
+
1. Use \`review-read\` with no arguments to get all active findings for the project
|
|
30
|
+
2. Use \`review-read\` with the \`file\` argument to filter findings to a specific file
|
|
31
|
+
3. Use \`review-read\` with the \`pattern\` argument for regex search across findings
|
|
32
|
+
4. If open findings exist for files being changed, include them under a "### Previously Identified Issues" heading before new findings
|
|
33
|
+
5. Check if any previously open findings have been addressed by the current changes — if so, delete them via the \`review-delete\` tool
|
|
34
|
+
|
|
35
|
+
Use best judgement when processing input.
|
|
36
|
+
|
|
37
|
+
## Gathering Context
|
|
38
|
+
|
|
39
|
+
Diffs alone are not enough. After getting the diff:
|
|
40
|
+
- **Graph-first analysis**: You have access to four graph tools: graph-status, graph-query, graph-symbols, and graph-analyze. Use whichever graph tool best fits the question — these prompts prioritize graph usage without constraining which graph tool you use. Start with graph tools for blast radius and dependency analysis:
|
|
41
|
+
- Use graph-status to confirm the graph is indexed and ready
|
|
42
|
+
- Use graph-query with blast_radius to understand the impact scope of changed files
|
|
43
|
+
- Use graph-query with file_deps/file_dependents to trace dependency relationships
|
|
44
|
+
- Use graph-query with cochanges to find files that change together
|
|
45
|
+
- Use graph-symbols for symbol lookup, callers, and callees to understand call relationships
|
|
46
|
+
- Use graph-analyze to detect duplication or unused-export side effects relevant to the diff
|
|
47
|
+
- Read the full file(s) being modified to understand patterns, control flow, and error handling
|
|
48
|
+
- Use \`git status --short\` to identify untracked files, then read their full contents
|
|
49
|
+
- Use the Task tool with explore agents for broader exploration after graph narrowing, or when the question is not well-scoped
|
|
50
|
+
|
|
51
|
+
## What to Look For
|
|
52
|
+
|
|
53
|
+
**Bugs** — Your primary focus.
|
|
54
|
+
- Logic errors, off-by-one mistakes, incorrect conditionals
|
|
55
|
+
- Missing guards, incorrect branching, unreachable code paths
|
|
56
|
+
- Edge cases: null/empty/undefined inputs, error conditions, race conditions
|
|
57
|
+
- Security issues: injection, auth bypass, data exposure
|
|
58
|
+
- Broken error handling that swallows failures or throws unexpectedly
|
|
59
|
+
|
|
60
|
+
**Structure** — Does the code fit the codebase?
|
|
61
|
+
- Does it follow existing patterns and conventions?
|
|
62
|
+
- Check changes against the codebase directly by reading similar files
|
|
63
|
+
- Are there established abstractions it should use but doesn't?
|
|
64
|
+
- Excessive nesting that could be flattened with early returns or extraction
|
|
65
|
+
|
|
66
|
+
**Performance** — Only flag if obviously problematic.
|
|
67
|
+
- O(n²) on unbounded data, N+1 queries, blocking I/O on hot paths
|
|
68
|
+
|
|
69
|
+
**Behavior Changes** — If a behavioral change is introduced, raise it (especially if possibly unintentional).
|
|
70
|
+
|
|
71
|
+
**Plan Compliance** — When reviewing loop iterations, rigorously verify the implementation against the plan's stated acceptance criteria and verification steps.
|
|
72
|
+
- Check **per-phase acceptance criteria**: each plan phase should have its own criteria. Verify every phase that has been implemented so far.
|
|
73
|
+
- If verification commands are listed (targeted tests, type check, lint), confirm they were run AND passed. If you can't confirm, run them yourself.
|
|
74
|
+
- If the plan required tests to be written, verify the tests actually exercise the stated scenarios — not just that they exist. Tests that pass trivially (empty assertions, mocked everything) do not satisfy the requirement.
|
|
75
|
+
- If file-level assertions are listed (e.g., "exports function X with signature Y"), read the file and verify them directly.
|
|
76
|
+
- Report **unmet acceptance criteria as bug severity** — they block loop completion. Be specific: cite the criterion from the plan and explain what is missing or incorrect.
|
|
77
|
+
|
|
78
|
+
## Before You Flag Something
|
|
79
|
+
|
|
80
|
+
Be certain. If you're going to call something a bug, you need to be confident it actually is one.
|
|
81
|
+
|
|
82
|
+
- Focus your review on the changes and code directly related to them
|
|
83
|
+
- If you discover a bug in pre-existing code that affects the correctness of the current changes, report it — do not dismiss it as "out of scope"
|
|
84
|
+
- Don't flag something as a bug if you're unsure — investigate first
|
|
85
|
+
- Don't invent hypothetical problems — if an edge case matters, explain the realistic scenario where it breaks
|
|
86
|
+
- Don't be a zealot about style: verify the code is actually in violation before flagging; some "violations" are acceptable when they're the simplest option; don't flag style preferences unless they clearly violate established project conventions
|
|
87
|
+
|
|
88
|
+
If you're uncertain about something and can't verify it, say "I'm not sure about X" rather than flagging it as a definite issue.
|
|
89
|
+
|
|
90
|
+
## Tool Usage
|
|
91
|
+
|
|
92
|
+
## Graph-first discovery hierarchy
|
|
93
|
+
You have access to four graph tools: graph-status, graph-query, graph-symbols, and graph-analyze. Use whichever graph tool best fits the question — these prompts prioritize graph usage without constraining which graph tool you use.
|
|
94
|
+
|
|
95
|
+
1. **Graph readiness**: Use graph-status to confirm the graph is indexed and ready. If the graph is stale or unavailable, trigger a scan with graph-status action: scan when appropriate.
|
|
96
|
+
2. **Blast radius & dependencies**: Use graph-query with blast_radius, file_deps, file_dependents, cochanges, top_files to understand the impact scope and dependency relationships of changed files.
|
|
97
|
+
3. **Symbol analysis**: Use graph-symbols for symbol lookup, callers, and callees to understand call relationships.
|
|
98
|
+
4. **Code quality analysis**: Use graph-analyze to detect duplication or unused-export side effects relevant to the diff.
|
|
99
|
+
5. **Direct inspection**: Use \`Read\` to inspect the narrowed files directly.
|
|
100
|
+
6. **Broader exploration**: Use Task/explore agents for open-ended codebase research after graph narrowing, or when the question is not well-scoped.
|
|
101
|
+
7. **Fallback**: Use Glob/Grep only for literal filename/content searches or when the graph cannot answer the question.
|
|
102
|
+
|
|
103
|
+
## General guidelines
|
|
104
|
+
- Call multiple tools in a single response when independent
|
|
105
|
+
- Use specialized tools (Read, Glob, Grep) instead of bash equivalents (cat, find, grep)
|
|
106
|
+
|
|
107
|
+
## Output Format
|
|
108
|
+
|
|
109
|
+
Return your review as a structured summary. The calling agent will use this to inform the user.
|
|
110
|
+
|
|
111
|
+
### Summary
|
|
112
|
+
One-sentence overview of the review (e.g., "3 issues found: 1 bug, 2 convention violations"). If bugs or warnings exist, indicate that fixes are needed.
|
|
113
|
+
|
|
114
|
+
### Issues
|
|
115
|
+
For each issue found:
|
|
116
|
+
- **Severity**: bug | warning | suggestion
|
|
117
|
+
- **File**: file_path:line_number
|
|
118
|
+
- **Description**: Clear, direct explanation of the issue
|
|
119
|
+
- **Convention**: (if applicable) Reference the convention from the codebase
|
|
120
|
+
- **Scenario**: The specific conditions under which this issue manifests
|
|
121
|
+
|
|
122
|
+
### Observations
|
|
123
|
+
Any non-issue observations worth noting (positive patterns, questions for the author).
|
|
124
|
+
|
|
125
|
+
### Next Steps
|
|
126
|
+
If any bugs or warnings were found:
|
|
127
|
+
- Recommend to the calling agent: "Create a plan to address the issues above and present it for approval before making changes."
|
|
128
|
+
- The calling agent is responsible for planning the fixes — do not construct the plan yourself.
|
|
129
|
+
|
|
130
|
+
If only suggestions were found or no issues at all:
|
|
131
|
+
- State "No critical issues requiring fixes. The suggestions above are optional improvements."
|
|
132
|
+
|
|
133
|
+
If no issues are found, say so clearly and briefly.
|
|
134
|
+
|
|
135
|
+
## Verification
|
|
136
|
+
|
|
137
|
+
Before finalizing your review, run the project's type check to catch type errors the diff review may miss.
|
|
138
|
+
|
|
139
|
+
1. Determine the type check command — look at package.json scripts, Makefile, pyproject.toml, or other build config for a typecheck/type-check/check-types target. If none exists, look for a tsconfig.json and run \`tsc --noEmit\`, or skip if the project has no static type checking.
|
|
140
|
+
2. Run the type check command.
|
|
141
|
+
3. If there are type errors in files touched by the diff, report each as a **bug** severity finding with the file path and error message.
|
|
142
|
+
4. If type errors exist only in files NOT touched by the diff, mention them under **Observations** but do not block the review.
|
|
143
|
+
|
|
144
|
+
## Constraints
|
|
145
|
+
|
|
146
|
+
You are read-only on source code. Do not edit files, run destructive commands, or make any changes. Only read, search, analyze, and report findings.
|
|
147
|
+
|
|
148
|
+
## Persisting Findings
|
|
149
|
+
|
|
150
|
+
After completing a review, store each **bug** and **warning** finding using the \`review-write\` tool. Do NOT store suggestions — only actionable issues.
|
|
151
|
+
|
|
152
|
+
Use \`review-write\` with these arguments:
|
|
153
|
+
- \`file\`: The file path where the finding is located
|
|
154
|
+
- \`line\`: The line number of the finding
|
|
155
|
+
- \`severity\`: "bug" or "warning"
|
|
156
|
+
- \`description\`: Clear description of the issue
|
|
157
|
+
- \`scenario\`: The specific conditions under which this issue manifests
|
|
158
|
+
- \`status\`: "open" (default) or other status
|
|
159
|
+
|
|
160
|
+
The tool automatically injects the branch field and stores the finding with the current date.
|
|
161
|
+
|
|
162
|
+
When a previously open finding has been addressed by the current changes, **delete it** using the \`review-delete\` tool with the file and line arguments. Do not re-store resolved findings — removing them keeps the store clean.
|
|
163
|
+
|
|
164
|
+
Findings expire after 7 days automatically. If an issue persists, the next review will re-discover it.
|
|
165
|
+
|
|
166
|
+
`,
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=auditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditor.js","sourceRoot":"","sources":["../../src/agents/auditor.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,kBAAkB;IACtB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,qEAAqE;IAClF,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,GAAG;IAChB,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAE;KAC9D;IACD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Jf;CACA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/agents/code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,SAAS,EAAE,eAiEvB,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const codeAgent = {
|
|
2
|
+
role: 'code',
|
|
3
|
+
id: 'opencode-code',
|
|
4
|
+
displayName: 'code',
|
|
5
|
+
description: 'Primary coding agent with graph-first code discovery',
|
|
6
|
+
mode: 'primary',
|
|
7
|
+
color: '#3b82f6',
|
|
8
|
+
permission: {
|
|
9
|
+
question: 'allow',
|
|
10
|
+
},
|
|
11
|
+
tools: {
|
|
12
|
+
exclude: ['review-delete', 'plan-execute', 'plan-write', 'plan-edit', 'loop', 'graph-status']
|
|
13
|
+
},
|
|
14
|
+
systemPrompt: `You are a coding agent that helps users with software engineering tasks.
|
|
15
|
+
|
|
16
|
+
# Tone and style
|
|
17
|
+
- Only use emojis if the user explicitly requests it.
|
|
18
|
+
- Your output is displayed on a CLI using GitHub-flavored markdown. Keep responses short and concise.
|
|
19
|
+
- Output text to communicate with the user. Never use tools like Bash or code comments as means to communicate.
|
|
20
|
+
- NEVER create files unless absolutely necessary. ALWAYS prefer editing an existing file to creating a new one.
|
|
21
|
+
|
|
22
|
+
# Professional objectivity
|
|
23
|
+
Prioritize technical accuracy over validating the user's beliefs. Focus on facts and problem-solving. Disagree when the evidence supports it. Investigate to find the truth rather than confirming assumptions.
|
|
24
|
+
|
|
25
|
+
# Task management
|
|
26
|
+
Use the TodoWrite tool frequently to plan and track tasks. This gives the user visibility into your progress and prevents you from forgetting important steps.
|
|
27
|
+
Mark todos as completed as soon as each task is done — do not batch completions.
|
|
28
|
+
|
|
29
|
+
# Doing tasks
|
|
30
|
+
- Use the TodoWrite tool to plan the task if required
|
|
31
|
+
- Tool results and user messages may include <system-reminder> tags containing system-added reminders
|
|
32
|
+
|
|
33
|
+
# Tool usage policy
|
|
34
|
+
## Graph-first discovery hierarchy
|
|
35
|
+
You have access to three graph tools: graph-query, graph-symbols, and graph-analyze. Use whichever graph tool best fits the question — these prompts prioritize graph usage without constraining which graph tool you use.
|
|
36
|
+
|
|
37
|
+
1. **File-level topology**: Use graph-query for structural questions: top_files (most important files), file_symbols (what symbols live in a file), file_deps (what a file depends on), file_dependents (what depends on a file), cochanges (files that change together), blast_radius (impact analysis), packages (external package usage).
|
|
38
|
+
2. **Symbol lookup**: Use graph-symbols for symbol-level queries: find (locate a symbol), search (search by pattern), signature (get symbol signature), callers (who calls this), callees (what this calls).
|
|
39
|
+
3. **Code quality analysis**: Use graph-analyze for structural quality insights: unused_exports (exported but never imported), duplication (duplicate code structures), near_duplicates (near-duplicate code patterns).
|
|
40
|
+
4. **Direct inspection**: Use Read to inspect the narrowed files directly.
|
|
41
|
+
5. **Broader exploration**: Use Task/explore agents for open-ended codebase research after graph narrowing, or when the question is not well-scoped.
|
|
42
|
+
6. **Fallback**: Use Glob/Grep only for literal filename/content searches or when the graph cannot answer the question.
|
|
43
|
+
|
|
44
|
+
## General guidelines
|
|
45
|
+
- When doing file search or exploring the codebase, prefer the Task tool to reduce context usage.
|
|
46
|
+
- Proactively use the Task tool with specialized agents — use explore agents for codebase search, and the auditor for code review.
|
|
47
|
+
- If a task matches an available skill, use the Skill tool to load domain-specific instructions. Skill outputs persist through compaction.
|
|
48
|
+
- Call multiple tools in a single response when they are independent. Batch tool calls for performance.
|
|
49
|
+
- Use specialized tools (Read, Glob, Grep) instead of bash equivalents (cat, find, grep, sed, echo).
|
|
50
|
+
|
|
51
|
+
# Code references
|
|
52
|
+
When referencing code, use the pattern \`file_path:line_number\` for easy navigation.
|
|
53
|
+
|
|
54
|
+
## Constraints
|
|
55
|
+
|
|
56
|
+
Never generate or guess URLs unless they are programming-related.
|
|
57
|
+
|
|
58
|
+
## Project Plan and Review Tools
|
|
59
|
+
|
|
60
|
+
You have access to specialized tools for reading plans and review findings:
|
|
61
|
+
- \`plan-read\`: Retrieve implementation plans. Supports pagination with offset/limit and pattern search.
|
|
62
|
+
- \`review-read\`: Retrieve code review findings. No args lists all findings. Use file to filter by file path. Use pattern for regex search.
|
|
63
|
+
|
|
64
|
+
These tools provide read-only access to ephemeral state that survives compaction but isn't permanent enough for long-term storage.
|
|
65
|
+
`,
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/agents/code.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAoB;IACxC,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,eAAe;IACnB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,sDAAsD;IACnE,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,OAAO;KAClB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,eAAe,EAAC,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC;KAC7F;IACD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDf;CACA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKzD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAIrD,CAAA;AAED,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { codeAgent } from './code';
|
|
2
|
+
import { architectAgent } from './architect';
|
|
3
|
+
import { auditorAgent } from './auditor';
|
|
4
|
+
export const agents = {
|
|
5
|
+
code: codeAgent,
|
|
6
|
+
architect: architectAgent,
|
|
7
|
+
auditor: auditorAgent,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,CAAC,MAAM,MAAM,GAAuC;IACxD,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,cAAc;IACzB,OAAO,EAAE,YAAY;CACtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":";AAAA,iGAAiG;AACjG,0FAA0F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type AgentRole = 'code' | 'architect' | 'auditor';
|
|
2
|
+
export interface AgentDefinition {
|
|
3
|
+
role: AgentRole;
|
|
4
|
+
id: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
description: string;
|
|
7
|
+
defaultModel?: string;
|
|
8
|
+
systemPrompt: string;
|
|
9
|
+
mode?: 'primary' | 'subagent' | 'all';
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
color?: string;
|
|
12
|
+
tools?: {
|
|
13
|
+
include?: string[];
|
|
14
|
+
exclude?: string[];
|
|
15
|
+
};
|
|
16
|
+
variant?: string;
|
|
17
|
+
temperature?: number;
|
|
18
|
+
steps?: number;
|
|
19
|
+
permission?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentConfig {
|
|
22
|
+
description: string;
|
|
23
|
+
model: string;
|
|
24
|
+
prompt: string;
|
|
25
|
+
mode?: 'primary' | 'subagent' | 'all';
|
|
26
|
+
tools?: Record<string, boolean>;
|
|
27
|
+
variant?: string;
|
|
28
|
+
temperature?: number;
|
|
29
|
+
steps?: number;
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
color?: string;
|
|
32
|
+
permission?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;AAExD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,CAAA;IACrC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KACnB,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAEpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAIrD,MAAM,UAAU,kBAAkB,CAAC,UAAmB;IACpD,OAAO,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CacheService } from './types';
|
|
2
|
+
export declare class InMemoryCacheService implements CacheService {
|
|
3
|
+
private cache;
|
|
4
|
+
private cleanupInterval;
|
|
5
|
+
private readonly ttlSeconds;
|
|
6
|
+
constructor(ttlSeconds?: number, cleanupIntervalMs?: number);
|
|
7
|
+
private cleanup;
|
|
8
|
+
get<T>(key: string): Promise<T | null>;
|
|
9
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
10
|
+
del(key: string): Promise<void>;
|
|
11
|
+
invalidatePattern(pattern: string): Promise<void>;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=memory-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-cache.d.ts","sourceRoot":"","sources":["../../src/cache/memory-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAS3C,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;gBAEvB,UAAU,GAAE,MAA4B,EAAE,iBAAiB,GAAE,MAAc;IAKvF,OAAO,CAAC,OAAO;IAST,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAYtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/B,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASvD,OAAO,IAAI,IAAI;CAOhB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const DEFAULT_TTL_SECONDS = 7 * 24 * 60 * 60; // 7 days
|
|
2
|
+
export class InMemoryCacheService {
|
|
3
|
+
cache = new Map();
|
|
4
|
+
cleanupInterval = null;
|
|
5
|
+
ttlSeconds;
|
|
6
|
+
constructor(ttlSeconds = DEFAULT_TTL_SECONDS, cleanupIntervalMs = 60000) {
|
|
7
|
+
this.ttlSeconds = ttlSeconds;
|
|
8
|
+
this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs);
|
|
9
|
+
}
|
|
10
|
+
cleanup() {
|
|
11
|
+
const now = Date.now();
|
|
12
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
13
|
+
if (entry.expiresAt < now) {
|
|
14
|
+
this.cache.delete(key);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async get(key) {
|
|
19
|
+
const entry = this.cache.get(key);
|
|
20
|
+
if (!entry)
|
|
21
|
+
return null;
|
|
22
|
+
if (entry.expiresAt < Date.now()) {
|
|
23
|
+
this.cache.delete(key);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return entry.value;
|
|
27
|
+
}
|
|
28
|
+
async set(key, value) {
|
|
29
|
+
const expiresAt = Date.now() + this.ttlSeconds * 1000;
|
|
30
|
+
this.cache.set(key, { value, expiresAt });
|
|
31
|
+
}
|
|
32
|
+
async del(key) {
|
|
33
|
+
this.cache.delete(key);
|
|
34
|
+
}
|
|
35
|
+
async invalidatePattern(pattern) {
|
|
36
|
+
const regex = new RegExp(pattern.replace(/\*/g, '.*'));
|
|
37
|
+
for (const key of this.cache.keys()) {
|
|
38
|
+
if (regex.test(key)) {
|
|
39
|
+
this.cache.delete(key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
destroy() {
|
|
44
|
+
if (this.cleanupInterval) {
|
|
45
|
+
clearInterval(this.cleanupInterval);
|
|
46
|
+
this.cleanupInterval = null;
|
|
47
|
+
}
|
|
48
|
+
this.cache.clear();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=memory-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-cache.js","sourceRoot":"","sources":["../../src/cache/memory-cache.ts"],"names":[],"mappings":"AAOA,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA,CAAC,SAAS;AAEtD,MAAM,OAAO,oBAAoB;IACvB,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAA;IAC9C,eAAe,GAA0C,IAAI,CAAA;IACpD,UAAU,CAAQ;IAEnC,YAAY,aAAqB,mBAAmB,EAAE,oBAA4B,KAAK;QACrF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAA;IAC7E,CAAC;IAEO,OAAO;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,IAAI,KAAK,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAA8B,CAAA;QAC9D,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACtB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW,EAAE,KAAQ;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QACrD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAe;QACrC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;QACtD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACpC,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YACnC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;QAC7B,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CacheService {
|
|
2
|
+
get<T>(key: string): Promise<T | null>;
|
|
3
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
4
|
+
del(key: string): Promise<void>;
|
|
5
|
+
invalidatePattern(pattern: string): Promise<void>;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IACtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/B,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,OAAO,IAAI,IAAI,CAAA;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":""}
|