micode 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -6
- package/dist/agents/executor.d.ts +2 -0
- package/dist/agents/index.d.ts +3 -1
- package/dist/agents/planner.d.ts +2 -0
- package/dist/index.js +367 -21
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -46,8 +46,11 @@ Output: `thoughts/shared/research/YYYY-MM-DD-{topic}.md`
|
|
|
46
46
|
|
|
47
47
|
### 3. Plan
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Transform validated designs into comprehensive implementation plans.
|
|
50
50
|
|
|
51
|
+
- Bite-sized tasks (2-5 minutes each)
|
|
52
|
+
- Exact file paths, complete code examples
|
|
53
|
+
- TDD workflow: failing test → verify fail → implement → verify pass → commit
|
|
51
54
|
- Get human approval before implementing
|
|
52
55
|
- Output: `thoughts/shared/plans/YYYY-MM-DD-{topic}.md`
|
|
53
56
|
|
|
@@ -59,9 +62,10 @@ Execute plan in git worktree for isolation:
|
|
|
59
62
|
git worktree add ../{feature} -b feature/{feature}
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
+
- **Executor** orchestrates the implement → review cycle automatically
|
|
66
|
+
- Spawns Implementer → waits → spawns Reviewer → loops if changes requested
|
|
67
|
+
- Maximum 3 cycles before escalating to human
|
|
68
|
+
- Commit with descriptive messages when approved
|
|
65
69
|
|
|
66
70
|
### 5. Handoff
|
|
67
71
|
|
|
@@ -87,8 +91,10 @@ Save/resume session state for continuity:
|
|
|
87
91
|
| codebase-locator | subagent | - | Find file locations |
|
|
88
92
|
| codebase-analyzer | subagent | - | Deep code analysis |
|
|
89
93
|
| pattern-finder | subagent | - | Find existing patterns |
|
|
90
|
-
|
|
|
91
|
-
|
|
|
94
|
+
| planner | subagent | claude-opus-4-5 | Create detailed implementation plans |
|
|
95
|
+
| executor | subagent | claude-opus-4-5 | Orchestrate implement → review cycle |
|
|
96
|
+
| implementer | subagent | claude-opus-4-5 | Execute implementation tasks |
|
|
97
|
+
| reviewer | subagent | claude-opus-4-5 | Review correctness and style |
|
|
92
98
|
| handoff-creator | subagent | - | Save session state |
|
|
93
99
|
| handoff-resumer | subagent | - | Resume from handoff |
|
|
94
100
|
|
|
@@ -115,6 +121,22 @@ Save/resume session state for continuity:
|
|
|
115
121
|
| Comment Checker | Validates edit tool comments |
|
|
116
122
|
| Session Recovery | Recovers from crashes |
|
|
117
123
|
|
|
124
|
+
## Permissions
|
|
125
|
+
|
|
126
|
+
All permissions are set to `allow` globally - no prompts for tool usage:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
config.permission = {
|
|
130
|
+
edit: "allow",
|
|
131
|
+
bash: "allow",
|
|
132
|
+
webfetch: "allow",
|
|
133
|
+
doom_loop: "allow",
|
|
134
|
+
external_directory: "allow",
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This enables subagents to work autonomously without getting stuck on permission prompts.
|
|
139
|
+
|
|
118
140
|
## MCP Servers
|
|
119
141
|
|
|
120
142
|
| Server | Description |
|
|
@@ -190,3 +212,10 @@ npm publish
|
|
|
190
212
|
4. **Parallel investigation** - Spawn multiple subagents for speed
|
|
191
213
|
5. **Isolated implementation** - Use git worktrees for features
|
|
192
214
|
6. **Continuous verification** - Implementer + Reviewer per phase
|
|
215
|
+
|
|
216
|
+
## Inspiration
|
|
217
|
+
|
|
218
|
+
Built on techniques from:
|
|
219
|
+
|
|
220
|
+
- **[oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode)** - OpenCode plugin architecture, agent orchestration patterns, and trusted publishing setup
|
|
221
|
+
- **[HumanLayer ACE-FCA](https://github.com/humanlayer/12-factor-agents)** - Advanced Context Engineering for Coding Agents, structured workflows, and the research → plan → implement methodology
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { brainstormerAgent } from "./brainstormer";
|
|
|
3
3
|
import { codebaseLocatorAgent } from "./codebase-locator";
|
|
4
4
|
import { codebaseAnalyzerAgent } from "./codebase-analyzer";
|
|
5
5
|
import { patternFinderAgent } from "./pattern-finder";
|
|
6
|
+
import { plannerAgent } from "./planner";
|
|
6
7
|
import { implementerAgent } from "./implementer";
|
|
7
8
|
import { reviewerAgent } from "./reviewer";
|
|
9
|
+
import { executorAgent } from "./executor";
|
|
8
10
|
import { handoffCreatorAgent } from "./handoff-creator";
|
|
9
11
|
import { handoffResumerAgent } from "./handoff-resumer";
|
|
10
12
|
import { primaryAgent, PRIMARY_AGENT_NAME } from "./commander";
|
|
11
13
|
import { projectInitializerAgent } from "./project-initializer";
|
|
12
14
|
export declare const agents: Record<string, AgentConfig>;
|
|
13
|
-
export { primaryAgent, PRIMARY_AGENT_NAME, brainstormerAgent, codebaseLocatorAgent, codebaseAnalyzerAgent, patternFinderAgent, implementerAgent, reviewerAgent, handoffCreatorAgent, handoffResumerAgent, projectInitializerAgent, };
|
|
15
|
+
export { primaryAgent, PRIMARY_AGENT_NAME, brainstormerAgent, codebaseLocatorAgent, codebaseAnalyzerAgent, patternFinderAgent, plannerAgent, implementerAgent, reviewerAgent, executorAgent, handoffCreatorAgent, handoffResumerAgent, projectInitializerAgent, };
|
package/dist/index.js
CHANGED
|
@@ -18,9 +18,11 @@ var brainstormerAgent = {
|
|
|
18
18
|
temperature: 0.7,
|
|
19
19
|
prompt: `<purpose>
|
|
20
20
|
Turn ideas into fully formed designs through natural collaborative dialogue.
|
|
21
|
+
This is DESIGN ONLY. The planner agent handles detailed implementation plans.
|
|
21
22
|
</purpose>
|
|
22
23
|
|
|
23
24
|
<critical-rules>
|
|
25
|
+
<rule>NO CODE: Never write code. Never provide code examples. Design only.</rule>
|
|
24
26
|
<rule>SUBAGENTS: Spawn multiple in parallel for codebase analysis.</rule>
|
|
25
27
|
<rule>TOOLS (grep, read, etc.): Do NOT use directly - use subagents instead.</rule>
|
|
26
28
|
<rule>Ask questions ONE AT A TIME in plain text. Wait for response before continuing.</rule>
|
|
@@ -79,11 +81,12 @@ Turn ideas into fully formed designs through natural collaborative dialogue.
|
|
|
79
81
|
<phase name="finalizing">
|
|
80
82
|
<action>Write validated design to thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md</action>
|
|
81
83
|
<action>Commit the design document to git</action>
|
|
82
|
-
<action>Ask: "Ready for
|
|
84
|
+
<action>Ask: "Ready for the planner to create a detailed implementation plan?"</action>
|
|
83
85
|
</phase>
|
|
84
86
|
</process>
|
|
85
87
|
|
|
86
88
|
<principles>
|
|
89
|
+
<principle name="design-only">NO CODE. Describe components, not implementations. Planner writes code.</principle>
|
|
87
90
|
<principle name="subagents-first">ALWAYS use subagents for code analysis, NEVER tools directly</principle>
|
|
88
91
|
<principle name="parallel-spawn">Spawn multiple subagents in a SINGLE message</principle>
|
|
89
92
|
<principle name="one-question">Ask ONE question at a time. Wait for answer.</principle>
|
|
@@ -91,9 +94,15 @@ Turn ideas into fully formed designs through natural collaborative dialogue.
|
|
|
91
94
|
<principle name="yagni">Remove unnecessary features from ALL designs</principle>
|
|
92
95
|
<principle name="explore-alternatives">ALWAYS propose 2-3 approaches before settling</principle>
|
|
93
96
|
<principle name="incremental-validation">Present in sections, validate each before proceeding</principle>
|
|
94
|
-
<principle name="no-implementation">This is design only, no code writing</principle>
|
|
95
97
|
</principles>
|
|
96
98
|
|
|
99
|
+
<never-do>
|
|
100
|
+
<forbidden>Never write code snippets or examples</forbidden>
|
|
101
|
+
<forbidden>Never provide file paths with line numbers</forbidden>
|
|
102
|
+
<forbidden>Never specify exact function signatures</forbidden>
|
|
103
|
+
<forbidden>Never jump to implementation details - stay at design level</forbidden>
|
|
104
|
+
</never-do>
|
|
105
|
+
|
|
97
106
|
<output-format path="thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md">
|
|
98
107
|
<frontmatter>
|
|
99
108
|
date: YYYY-MM-DD
|
|
@@ -330,6 +339,188 @@ Find existing patterns in the codebase to model after. Show, don't tell.
|
|
|
330
339
|
</quality-criteria>`
|
|
331
340
|
};
|
|
332
341
|
|
|
342
|
+
// src/agents/planner.ts
|
|
343
|
+
var plannerAgent = {
|
|
344
|
+
description: "Creates detailed implementation plans with exact file paths, complete code examples, and TDD steps",
|
|
345
|
+
mode: "subagent",
|
|
346
|
+
model: "anthropic/claude-opus-4-5",
|
|
347
|
+
temperature: 0.3,
|
|
348
|
+
prompt: `<purpose>
|
|
349
|
+
Transform validated designs into comprehensive implementation plans.
|
|
350
|
+
Plans assume the implementing engineer has zero codebase context.
|
|
351
|
+
Every task is bite-sized (2-5 minutes), with exact paths and complete code.
|
|
352
|
+
</purpose>
|
|
353
|
+
|
|
354
|
+
<critical-rules>
|
|
355
|
+
<rule>FOLLOW THE DESIGN: The brainstormer's design is the spec. Do not explore alternatives.</rule>
|
|
356
|
+
<rule>SUBAGENTS: Spawn for implementation details (paths, signatures, line numbers).</rule>
|
|
357
|
+
<rule>TOOLS (grep, read, etc.): Do NOT use directly - use subagents instead.</rule>
|
|
358
|
+
<rule>Every code example MUST be complete - never write "add validation here"</rule>
|
|
359
|
+
<rule>Every file path MUST be exact - never write "somewhere in src/"</rule>
|
|
360
|
+
<rule>Follow TDD: failing test \u2192 verify fail \u2192 implement \u2192 verify pass \u2192 commit</rule>
|
|
361
|
+
</critical-rules>
|
|
362
|
+
|
|
363
|
+
<research-scope>
|
|
364
|
+
Brainstormer did conceptual research (architecture, patterns, approaches).
|
|
365
|
+
Your research is IMPLEMENTATION-LEVEL only:
|
|
366
|
+
- Exact file paths and line numbers
|
|
367
|
+
- Exact function signatures and types
|
|
368
|
+
- Exact test file conventions
|
|
369
|
+
- Exact import paths
|
|
370
|
+
All research must serve the design - never second-guess design decisions.
|
|
371
|
+
</research-scope>
|
|
372
|
+
|
|
373
|
+
<available-subagents>
|
|
374
|
+
<subagent name="codebase-locator" spawn="parallel">
|
|
375
|
+
Find exact file paths needed for implementation.
|
|
376
|
+
Examples: "Find exact path to UserService", "Find test directory structure"
|
|
377
|
+
</subagent>
|
|
378
|
+
<subagent name="codebase-analyzer" spawn="parallel">
|
|
379
|
+
Get exact signatures and types for code examples.
|
|
380
|
+
Examples: "Get function signature for createUser", "Get type definition for UserConfig"
|
|
381
|
+
</subagent>
|
|
382
|
+
<subagent name="pattern-finder" spawn="parallel">
|
|
383
|
+
Find exact patterns to copy in code examples.
|
|
384
|
+
Examples: "Find exact test setup pattern", "Find exact error handling in similar endpoint"
|
|
385
|
+
</subagent>
|
|
386
|
+
</available-subagents>
|
|
387
|
+
|
|
388
|
+
<inputs>
|
|
389
|
+
<required>Design document from thoughts/shared/designs/</required>
|
|
390
|
+
<injected>CODE_STYLE.md - coding conventions (automatically available)</injected>
|
|
391
|
+
<injected>ARCHITECTURE.md - system structure (automatically available)</injected>
|
|
392
|
+
</inputs>
|
|
393
|
+
|
|
394
|
+
<process>
|
|
395
|
+
<phase name="understand-design">
|
|
396
|
+
<action>Read the design document thoroughly</action>
|
|
397
|
+
<action>Identify all components, files, and interfaces mentioned</action>
|
|
398
|
+
<action>Note any constraints or decisions made by brainstormer</action>
|
|
399
|
+
</phase>
|
|
400
|
+
|
|
401
|
+
<phase name="implementation-research">
|
|
402
|
+
<action>Spawn subagents in PARALLEL to gather exact details:</action>
|
|
403
|
+
<spawn-example>
|
|
404
|
+
In a SINGLE message, spawn:
|
|
405
|
+
- codebase-locator: "Find exact path to [component from design]"
|
|
406
|
+
- codebase-locator: "Find test file naming convention"
|
|
407
|
+
- codebase-analyzer: "Get exact signature for [function mentioned in design]"
|
|
408
|
+
- pattern-finder: "Find exact test setup pattern for [type of test]"
|
|
409
|
+
</spawn-example>
|
|
410
|
+
<rule>Only research what's needed to implement the design</rule>
|
|
411
|
+
<rule>Never research alternatives to design decisions</rule>
|
|
412
|
+
</phase>
|
|
413
|
+
|
|
414
|
+
<phase name="planning">
|
|
415
|
+
<action>Break design into sequential tasks (2-5 minutes each)</action>
|
|
416
|
+
<action>For each task, determine exact file paths from research</action>
|
|
417
|
+
<action>Write complete code examples following CODE_STYLE.md</action>
|
|
418
|
+
<action>Include exact verification commands with expected output</action>
|
|
419
|
+
</phase>
|
|
420
|
+
|
|
421
|
+
<phase name="output">
|
|
422
|
+
<action>Write plan to thoughts/shared/plans/YYYY-MM-DD-{topic}.md</action>
|
|
423
|
+
<action>Commit the plan document to git</action>
|
|
424
|
+
</phase>
|
|
425
|
+
</process>
|
|
426
|
+
|
|
427
|
+
<task-granularity>
|
|
428
|
+
Each step is ONE action (2-5 minutes):
|
|
429
|
+
- "Write the failing test" - one step
|
|
430
|
+
- "Run test to verify it fails" - one step
|
|
431
|
+
- "Implement minimal code to pass" - one step
|
|
432
|
+
- "Run test to verify it passes" - one step
|
|
433
|
+
- "Commit" - one step
|
|
434
|
+
</task-granularity>
|
|
435
|
+
|
|
436
|
+
<output-format path="thoughts/shared/plans/YYYY-MM-DD-{topic}.md">
|
|
437
|
+
<template>
|
|
438
|
+
# [Feature Name] Implementation Plan
|
|
439
|
+
|
|
440
|
+
**Goal:** [One sentence describing what this builds]
|
|
441
|
+
|
|
442
|
+
**Architecture:** [2-3 sentences about approach]
|
|
443
|
+
|
|
444
|
+
**Design:** [Link to thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md]
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## Task 1: [Component Name]
|
|
449
|
+
|
|
450
|
+
**Files:**
|
|
451
|
+
- Create: \`exact/path/to/file.ts\`
|
|
452
|
+
- Modify: \`exact/path/to/existing.ts:123-145\`
|
|
453
|
+
- Test: \`tests/exact/path/to/test.ts\`
|
|
454
|
+
|
|
455
|
+
**Step 1: Write the failing test**
|
|
456
|
+
|
|
457
|
+
\`\`\`typescript
|
|
458
|
+
// Complete test code - no placeholders
|
|
459
|
+
describe("FeatureName", () => {
|
|
460
|
+
it("should do specific thing", () => {
|
|
461
|
+
const result = functionName(input);
|
|
462
|
+
expect(result).toBe(expected);
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
\`\`\`
|
|
466
|
+
|
|
467
|
+
**Step 2: Run test to verify it fails**
|
|
468
|
+
|
|
469
|
+
Run: \`bun test tests/path/test.ts\`
|
|
470
|
+
Expected: FAIL with "functionName is not defined"
|
|
471
|
+
|
|
472
|
+
**Step 3: Write minimal implementation**
|
|
473
|
+
|
|
474
|
+
\`\`\`typescript
|
|
475
|
+
// Complete implementation - no placeholders
|
|
476
|
+
export function functionName(input: InputType): OutputType {
|
|
477
|
+
return expected;
|
|
478
|
+
}
|
|
479
|
+
\`\`\`
|
|
480
|
+
|
|
481
|
+
**Step 4: Run test to verify it passes**
|
|
482
|
+
|
|
483
|
+
Run: \`bun test tests/path/test.ts\`
|
|
484
|
+
Expected: PASS
|
|
485
|
+
|
|
486
|
+
**Step 5: Commit**
|
|
487
|
+
|
|
488
|
+
\`\`\`bash
|
|
489
|
+
git add tests/path/test.ts src/path/file.ts
|
|
490
|
+
git commit -m "feat(scope): add specific feature"
|
|
491
|
+
\`\`\`
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## Task 2: [Next Component]
|
|
496
|
+
...
|
|
497
|
+
|
|
498
|
+
</template>
|
|
499
|
+
</output-format>
|
|
500
|
+
|
|
501
|
+
<principles>
|
|
502
|
+
<principle name="zero-context">Engineer knows nothing about our codebase</principle>
|
|
503
|
+
<principle name="complete-code">Every code block is copy-paste ready</principle>
|
|
504
|
+
<principle name="exact-paths">Every file path is absolute from project root</principle>
|
|
505
|
+
<principle name="tdd-always">Every feature starts with a failing test</principle>
|
|
506
|
+
<principle name="small-steps">Each step takes 2-5 minutes max</principle>
|
|
507
|
+
<principle name="verify-everything">Every step has a verification command</principle>
|
|
508
|
+
<principle name="frequent-commits">Commit after each passing test</principle>
|
|
509
|
+
<principle name="yagni">Only what's needed - no extras</principle>
|
|
510
|
+
<principle name="dry">Extract duplication in code examples</principle>
|
|
511
|
+
</principles>
|
|
512
|
+
|
|
513
|
+
<never-do>
|
|
514
|
+
<forbidden>Never second-guess the design - brainstormer made those decisions</forbidden>
|
|
515
|
+
<forbidden>Never propose alternative approaches - implement what's in the design</forbidden>
|
|
516
|
+
<forbidden>Never write "add validation here" - write the actual validation</forbidden>
|
|
517
|
+
<forbidden>Never write "src/somewhere/" - write the exact path</forbidden>
|
|
518
|
+
<forbidden>Never skip the failing test step</forbidden>
|
|
519
|
+
<forbidden>Never combine multiple features in one task</forbidden>
|
|
520
|
+
<forbidden>Never assume the reader knows our patterns</forbidden>
|
|
521
|
+
</never-do>`
|
|
522
|
+
};
|
|
523
|
+
|
|
333
524
|
// src/agents/implementer.ts
|
|
334
525
|
var implementerAgent = {
|
|
335
526
|
description: "Executes implementation tasks from a plan",
|
|
@@ -506,6 +697,154 @@ Check correctness and style. Be specific. Run code, don't just read.
|
|
|
506
697
|
</priority-order>`
|
|
507
698
|
};
|
|
508
699
|
|
|
700
|
+
// src/agents/executor.ts
|
|
701
|
+
var executorAgent = {
|
|
702
|
+
description: "Executes plan task-by-task with parallel execution where possible",
|
|
703
|
+
mode: "subagent",
|
|
704
|
+
model: "anthropic/claude-opus-4-5",
|
|
705
|
+
temperature: 0.2,
|
|
706
|
+
prompt: `<purpose>
|
|
707
|
+
Execute plan tasks with maximum parallelism.
|
|
708
|
+
Each task gets its own implementer \u2192 reviewer cycle.
|
|
709
|
+
Detect and parallelize independent tasks.
|
|
710
|
+
</purpose>
|
|
711
|
+
|
|
712
|
+
<workflow>
|
|
713
|
+
<step>Parse plan to extract individual tasks</step>
|
|
714
|
+
<step>Analyze task dependencies to build execution graph</step>
|
|
715
|
+
<step>Group tasks into parallel batches (independent tasks run together)</step>
|
|
716
|
+
<step>For each batch: spawn implementer \u2192 reviewer per task IN PARALLEL</step>
|
|
717
|
+
<step>Wait for batch to complete before starting dependent batch</step>
|
|
718
|
+
<step>Aggregate results and report</step>
|
|
719
|
+
</workflow>
|
|
720
|
+
|
|
721
|
+
<dependency-analysis>
|
|
722
|
+
Tasks are INDEPENDENT (can parallelize) when:
|
|
723
|
+
- They modify different files
|
|
724
|
+
- They don't depend on each other's output
|
|
725
|
+
- They don't share state
|
|
726
|
+
|
|
727
|
+
Tasks are DEPENDENT (must be sequential) when:
|
|
728
|
+
- Task B modifies a file that Task A creates
|
|
729
|
+
- Task B imports/uses something Task A defines
|
|
730
|
+
- Task B's test relies on Task A's implementation
|
|
731
|
+
- Plan explicitly states ordering
|
|
732
|
+
|
|
733
|
+
When uncertain, assume DEPENDENT (safer).
|
|
734
|
+
</dependency-analysis>
|
|
735
|
+
|
|
736
|
+
<execution-pattern>
|
|
737
|
+
Example: 9 tasks where tasks 1-3 are independent, 4-6 depend on 1-3, 7-9 depend on 4-6
|
|
738
|
+
|
|
739
|
+
Batch 1 (parallel):
|
|
740
|
+
- Spawn implementer for task 1 \u2192 reviewer
|
|
741
|
+
- Spawn implementer for task 2 \u2192 reviewer
|
|
742
|
+
- Spawn implementer for task 3 \u2192 reviewer
|
|
743
|
+
[Wait for all to complete]
|
|
744
|
+
|
|
745
|
+
Batch 2 (parallel):
|
|
746
|
+
- Spawn implementer for task 4 \u2192 reviewer
|
|
747
|
+
- Spawn implementer for task 5 \u2192 reviewer
|
|
748
|
+
- Spawn implementer for task 6 \u2192 reviewer
|
|
749
|
+
[Wait for all to complete]
|
|
750
|
+
|
|
751
|
+
Batch 3 (parallel):
|
|
752
|
+
- Spawn implementer for task 7 \u2192 reviewer
|
|
753
|
+
- Spawn implementer for task 8 \u2192 reviewer
|
|
754
|
+
- Spawn implementer for task 9 \u2192 reviewer
|
|
755
|
+
[Wait for all to complete]
|
|
756
|
+
</execution-pattern>
|
|
757
|
+
|
|
758
|
+
<available-subagents>
|
|
759
|
+
<subagent name="implementer" spawn="parallel-per-task">
|
|
760
|
+
Executes ONE task from the plan.
|
|
761
|
+
Input: Single task with context (which files, what to do).
|
|
762
|
+
Output: Changes made and verification results for that task.
|
|
763
|
+
</subagent>
|
|
764
|
+
<subagent name="reviewer" spawn="parallel-per-task">
|
|
765
|
+
Reviews ONE task's implementation.
|
|
766
|
+
Input: Single task's changes against its requirements.
|
|
767
|
+
Output: APPROVED or CHANGES REQUESTED for that task.
|
|
768
|
+
</subagent>
|
|
769
|
+
</available-subagents>
|
|
770
|
+
|
|
771
|
+
<per-task-cycle>
|
|
772
|
+
For each task:
|
|
773
|
+
1. Spawn implementer with task details
|
|
774
|
+
2. Wait for implementer to complete
|
|
775
|
+
3. Spawn reviewer to check that task
|
|
776
|
+
4. If reviewer requests changes: re-spawn implementer for fixes
|
|
777
|
+
5. Max 3 cycles per task before marking as blocked
|
|
778
|
+
6. Report task status: DONE / BLOCKED
|
|
779
|
+
</per-task-cycle>
|
|
780
|
+
|
|
781
|
+
<parallel-spawning>
|
|
782
|
+
Within a batch, spawn ALL implementers in a SINGLE message:
|
|
783
|
+
|
|
784
|
+
Example for batch with tasks 1, 2, 3:
|
|
785
|
+
- In ONE message, spawn:
|
|
786
|
+
- implementer: "Execute task 1: [details]"
|
|
787
|
+
- implementer: "Execute task 2: [details]"
|
|
788
|
+
- implementer: "Execute task 3: [details]"
|
|
789
|
+
|
|
790
|
+
Then after all complete, in ONE message spawn:
|
|
791
|
+
- reviewer: "Review task 1 implementation"
|
|
792
|
+
- reviewer: "Review task 2 implementation"
|
|
793
|
+
- reviewer: "Review task 3 implementation"
|
|
794
|
+
</parallel-spawning>
|
|
795
|
+
|
|
796
|
+
<rules>
|
|
797
|
+
<rule>Parse ALL tasks from plan before starting execution</rule>
|
|
798
|
+
<rule>ALWAYS analyze dependencies before parallelizing</rule>
|
|
799
|
+
<rule>Spawn parallel tasks in SINGLE message for true parallelism</rule>
|
|
800
|
+
<rule>Wait for entire batch before starting next batch</rule>
|
|
801
|
+
<rule>Each task gets its own implement \u2192 review cycle</rule>
|
|
802
|
+
<rule>Max 3 review cycles per task</rule>
|
|
803
|
+
<rule>Continue with other tasks if one is blocked</rule>
|
|
804
|
+
</rules>
|
|
805
|
+
|
|
806
|
+
<output-format>
|
|
807
|
+
<template>
|
|
808
|
+
## Execution Complete
|
|
809
|
+
|
|
810
|
+
**Plan**: [plan file path]
|
|
811
|
+
**Total tasks**: [N]
|
|
812
|
+
**Batches**: [M] (based on dependency analysis)
|
|
813
|
+
|
|
814
|
+
### Dependency Analysis
|
|
815
|
+
- Batch 1 (parallel): Tasks 1, 2, 3 - independent, no shared files
|
|
816
|
+
- Batch 2 (parallel): Tasks 4, 5 - depend on batch 1
|
|
817
|
+
- Batch 3 (sequential): Task 6 - depends on task 5 specifically
|
|
818
|
+
|
|
819
|
+
### Results
|
|
820
|
+
|
|
821
|
+
| Task | Status | Cycles | Notes |
|
|
822
|
+
|------|--------|--------|-------|
|
|
823
|
+
| 1 | \u2705 DONE | 1 | |
|
|
824
|
+
| 2 | \u2705 DONE | 2 | Fixed type error on cycle 2 |
|
|
825
|
+
| 3 | \u274C BLOCKED | 3 | Could not resolve: [issue] |
|
|
826
|
+
| ... | | | |
|
|
827
|
+
|
|
828
|
+
### Summary
|
|
829
|
+
- Completed: [X]/[N] tasks
|
|
830
|
+
- Blocked: [Y] tasks need human intervention
|
|
831
|
+
|
|
832
|
+
### Blocked Tasks (if any)
|
|
833
|
+
**Task 3**: [description of blocker and last reviewer feedback]
|
|
834
|
+
|
|
835
|
+
**Next**: [Ready to commit / Needs human decision on blocked tasks]
|
|
836
|
+
</template>
|
|
837
|
+
</output-format>
|
|
838
|
+
|
|
839
|
+
<never-do>
|
|
840
|
+
<forbidden>Never skip dependency analysis</forbidden>
|
|
841
|
+
<forbidden>Never spawn dependent tasks in parallel</forbidden>
|
|
842
|
+
<forbidden>Never skip reviewer for any task</forbidden>
|
|
843
|
+
<forbidden>Never continue past 3 cycles for a single task</forbidden>
|
|
844
|
+
<forbidden>Never report success if any task is blocked</forbidden>
|
|
845
|
+
</never-do>`
|
|
846
|
+
};
|
|
847
|
+
|
|
509
848
|
// src/agents/handoff-creator.ts
|
|
510
849
|
var handoffCreatorAgent = {
|
|
511
850
|
description: "Creates handoff documents for session continuity",
|
|
@@ -691,17 +1030,13 @@ Just do it - including obvious follow-up actions.
|
|
|
691
1030
|
|
|
692
1031
|
<workflow description="For non-trivial work">
|
|
693
1032
|
<phase name="brainstorm" trigger="unclear requirements">
|
|
694
|
-
<action>
|
|
1033
|
+
<action>Tell user to invoke brainstormer for interactive design exploration</action>
|
|
1034
|
+
<note>Brainstormer is primary agent - user must invoke directly</note>
|
|
695
1035
|
<output>thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md</output>
|
|
696
1036
|
</phase>
|
|
697
1037
|
|
|
698
|
-
<phase name="
|
|
699
|
-
<action
|
|
700
|
-
<output>thoughts/shared/research/YYYY-MM-DD-{topic}.md</output>
|
|
701
|
-
</phase>
|
|
702
|
-
|
|
703
|
-
<phase name="plan" trigger="before multi-file implementation">
|
|
704
|
-
<action>Use research, write plan with phases and verification</action>
|
|
1038
|
+
<phase name="plan" trigger="design exists OR requirements clear">
|
|
1039
|
+
<action>Spawn planner with design document (planner does its own research)</action>
|
|
705
1040
|
<output>thoughts/shared/plans/YYYY-MM-DD-{topic}.md</output>
|
|
706
1041
|
<action>Get approval before implementation</action>
|
|
707
1042
|
</phase>
|
|
@@ -714,8 +1049,8 @@ Just do it - including obvious follow-up actions.
|
|
|
714
1049
|
</phase>
|
|
715
1050
|
|
|
716
1051
|
<phase name="implement">
|
|
717
|
-
<action
|
|
718
|
-
<action>
|
|
1052
|
+
<action>Spawn executor (handles implementer + reviewer automatically)</action>
|
|
1053
|
+
<action>Executor loops until reviewer approves or escalates</action>
|
|
719
1054
|
<on-mismatch>STOP, report, ask. Don't improvise.</on-mismatch>
|
|
720
1055
|
</phase>
|
|
721
1056
|
|
|
@@ -734,17 +1069,17 @@ Just do it - including obvious follow-up actions.
|
|
|
734
1069
|
</workflow>
|
|
735
1070
|
|
|
736
1071
|
<agents>
|
|
737
|
-
<agent name="brainstormer" purpose="Design exploration"/>
|
|
738
|
-
<agent name="codebase-locator" purpose="Find WHERE files are"/>
|
|
739
|
-
<agent name="codebase-analyzer" purpose="Explain HOW code works"/>
|
|
740
|
-
<agent name="pattern-finder" purpose="Find existing patterns"/>
|
|
741
|
-
<agent name="
|
|
742
|
-
<agent name="
|
|
743
|
-
<agent name="handoff-creator" purpose="Create handoff docs"/>
|
|
744
|
-
<agent name="handoff-resumer" purpose="Resume from handoffs"/>
|
|
1072
|
+
<agent name="brainstormer" mode="primary" purpose="Design exploration (user invokes directly)"/>
|
|
1073
|
+
<agent name="codebase-locator" mode="subagent" purpose="Find WHERE files are"/>
|
|
1074
|
+
<agent name="codebase-analyzer" mode="subagent" purpose="Explain HOW code works"/>
|
|
1075
|
+
<agent name="pattern-finder" mode="subagent" purpose="Find existing patterns"/>
|
|
1076
|
+
<agent name="planner" mode="subagent" purpose="Create detailed implementation plans"/>
|
|
1077
|
+
<agent name="executor" mode="subagent" purpose="Execute plan (runs implementer then reviewer automatically)"/>
|
|
1078
|
+
<agent name="handoff-creator" mode="subagent" purpose="Create handoff docs"/>
|
|
1079
|
+
<agent name="handoff-resumer" mode="subagent" purpose="Resume from handoffs"/>
|
|
745
1080
|
<parallelization>
|
|
746
1081
|
<safe>locator, analyzer, pattern-finder</safe>
|
|
747
|
-
<sequential>
|
|
1082
|
+
<sequential>planner then executor</sequential>
|
|
748
1083
|
</parallelization>
|
|
749
1084
|
</agents>
|
|
750
1085
|
|
|
@@ -965,6 +1300,7 @@ var PROMPT2 = `
|
|
|
965
1300
|
</agent>
|
|
966
1301
|
`;
|
|
967
1302
|
var projectInitializerAgent = {
|
|
1303
|
+
mode: "subagent",
|
|
968
1304
|
model: "anthropic/claude-opus-4-5",
|
|
969
1305
|
temperature: 0.3,
|
|
970
1306
|
maxTokens: 32000,
|
|
@@ -978,8 +1314,10 @@ var agents = {
|
|
|
978
1314
|
"codebase-locator": codebaseLocatorAgent,
|
|
979
1315
|
"codebase-analyzer": codebaseAnalyzerAgent,
|
|
980
1316
|
"pattern-finder": patternFinderAgent,
|
|
1317
|
+
planner: plannerAgent,
|
|
981
1318
|
implementer: implementerAgent,
|
|
982
1319
|
reviewer: reviewerAgent,
|
|
1320
|
+
executor: executorAgent,
|
|
983
1321
|
"handoff-creator": handoffCreatorAgent,
|
|
984
1322
|
"handoff-resumer": handoffResumerAgent,
|
|
985
1323
|
"project-initializer": projectInitializerAgent
|
|
@@ -15001,6 +15339,14 @@ var OpenCodeConfigPlugin = async (ctx) => {
|
|
|
15001
15339
|
...backgroundTaskTools
|
|
15002
15340
|
},
|
|
15003
15341
|
config: async (config2) => {
|
|
15342
|
+
config2.permission = {
|
|
15343
|
+
...config2.permission,
|
|
15344
|
+
edit: "allow",
|
|
15345
|
+
bash: "allow",
|
|
15346
|
+
webfetch: "allow",
|
|
15347
|
+
doom_loop: "allow",
|
|
15348
|
+
external_directory: "allow"
|
|
15349
|
+
};
|
|
15004
15350
|
config2.agent = {
|
|
15005
15351
|
Commander: agents[PRIMARY_AGENT_NAME],
|
|
15006
15352
|
...Object.fromEntries(Object.entries(agents).filter(([k]) => k !== PRIMARY_AGENT_NAME)),
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "micode",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "OpenCode plugin with Brainstorm-Research-Plan-Implement workflow",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"INSTALL_CLAUDE.md"
|
|
11
|
+
],
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"types": "./dist/index.d.ts",
|
|
@@ -18,7 +21,13 @@
|
|
|
18
21
|
"typecheck": "tsc --noEmit",
|
|
19
22
|
"prepublishOnly": "bun run clean && bun run build"
|
|
20
23
|
},
|
|
21
|
-
"keywords": [
|
|
24
|
+
"keywords": [
|
|
25
|
+
"opencode",
|
|
26
|
+
"plugin",
|
|
27
|
+
"research",
|
|
28
|
+
"plan",
|
|
29
|
+
"implement"
|
|
30
|
+
],
|
|
22
31
|
"author": "vtemian",
|
|
23
32
|
"license": "MIT",
|
|
24
33
|
"repository": {
|
|
@@ -30,7 +39,7 @@
|
|
|
30
39
|
"url": "https://github.com/vtemian/micode/issues"
|
|
31
40
|
},
|
|
32
41
|
"dependencies": {
|
|
33
|
-
"@opencode-ai/plugin": "1.0.
|
|
42
|
+
"@opencode-ai/plugin": "1.0.191"
|
|
34
43
|
},
|
|
35
44
|
"devDependencies": {
|
|
36
45
|
"bun-types": "latest",
|