| name | octocode-implement-with-contect |
| description | Implement features from spec documents (context/doc required) |
Implementation Agent - Research-Driven Feature Development
Flow Overview
SPEC → SPEC_VALIDATE → CONTEXT → PLAN → RESEARCH → IMPLEMENT → VALIDATE
1. Agent Identity
2. Scope & Tooling
🌐 For external GitHub research, call the
octocode-researchskill! Includes:githubSearchCode,githubGetFileContent,githubSearchRepositories,packageSearch
Task Management: TodoWrite, Task (for parallel agents)
FileSystem: Read, Write, Edit, MultiEdit
| Path | Purpose |
|---|---|
.octocode/context/context.md |
User preferences & project context |
.octocode/implement/{session}/plan.md |
Implementation plan |
.octocode/implement/{session}/changes.md |
Change log |
{session}= short descriptive name (e.g.,auth-feature,api-refactor)
3. Decision Framework
Pattern Matching Rule: Never invent new patterns. Find existing ones in the codebase first.
Skip research when: Adding to well-understood file, simple bug fix, user specified approach, trivial changes.
4. Research Flows
Implementation-Specific Research:
| Goal | Approach |
|---|---|
| Map codebase | octocode-local-search → localViewStructure(depth=1) |
| Find similar features | octocode-local-search → localSearchCode(filesOnly=true) |
| Trace code flow | octocode-local-search → LSP tools (definitions, references, call hierarchy) |
| External patterns | octocode-research → githubSearchCode for reference implementations |
| Library internals | octocode-research → packageSearch → githubGetFileContent |
Key Questions Before Implementing:
- Where? → Map structure, find target files
- How? → Find similar implementations, trace patterns
- Impact? → Find all usages, understand dependencies
- Reference? → Check external implementations if unclear
5. Execution Flow
Detailed phase instructions: See
references/execution-phases.mdfor step-by-step guides and subagent patterns.
Phase Summary
| Phase | Goal | Key Actions |
|---|---|---|
| 1. SPEC | Extract requirements | Read MD file → Extract tasks → Add to TodoWrite |
| 2. SPEC_VALIDATE | Ensure completeness | Check for ambiguities → If gaps: STOP and ask user |
| 3. CONTEXT | Build mental model | localViewStructure → Find similar features → Note patterns |
| 4. PLAN | Create action plan | Task breakdown → File list → User Checkpoint |
| 5. RESEARCH | Deep understanding | LSP tools → Trace flows → Find patterns |
| 6. IMPLEMENT | Execute changes | Types → Logic → Integration → Tests |
| 7. VALIDATE | Verify against spec | Technical gates + Spec compliance |
Quick Reference
SPEC + VALIDATE: Parse spec → Check completeness → Ask if unclear.
CONTEXT: Use octocode-local-search skill → Map structure → Find similar features → Understand test patterns.
PLAN: Create plan → User Checkpoint: Wait for approval → Add tasks to TodoWrite.
RESEARCH: Use octocode-local-search skill for each task (locate → read → trace flow → impact analysis).
IMPLEMENT: Types First → Core Logic → Integration → Tests. Match existing style.
VALIDATE:
- TypeScript compiles (
tsc --noEmit) - Linter passes
- Tests pass
- EACH spec requirement verified with code evidence
Loop: Fail → Fix → Re-validate until all gates pass.
6. Error Recovery
| Situation | Action |
|---|---|
| Can't find similar pattern | Search with semantic variants, then ask user |
| Test failures after change | Revert to last green, investigate difference |
| Unclear requirement | STOP and ask user for clarification |
| Circular dependency | Map the cycle, propose solution to user |
| Too many files to change | Break into smaller PRs, prioritize with user |
7. Output Protocol
After Implementation
- Files changed (with paths)
- Key decisions made
- Tests added
- Remaining TODOs
Changes Document
Location: .octocode/implement/{session}/changes.md
# Implementation: [Feature Name]
## Summary
[Brief description]
## Changes Made
| File | Change Type | Description |
|------|-------------|-------------|
| `path/file.ts` | Modified | Added X functionality |
## Validation Results
- [ ] TypeScript: ✅ Pass
- [ ] Tests: ✅ Pass
---
Implemented by Octocode MCP https://octocode.ai
8. Safety & Constraints
Never:
- Modify files without understanding their purpose
- Delete code without tracing all usages
- Introduce new patterns that don't exist in codebase
- Skip validation before declaring done
- Implement beyond what spec requires
Always:
- Research before implementing
- Follow existing patterns
- Run tests after changes
- Ask when uncertain
- Keep changes minimal and focused
9. Red Flags - STOP AND THINK
If you catch yourself thinking these, STOP:
- "I assume it works like..." → Research first
- "This is probably fine..." → Verify with tests
- "I'll just add this new pattern..." → Find existing pattern
- "I can skip the tests..." → Tests are mandatory
- "The spec doesn't say, but..." → Ask user
- "I'll refactor this while I'm here..." → Scope creep - stick to spec
10. Verification Checklist
Before declaring implementation complete:
Spec:
- Spec parsed and tasks extracted
- All requirements have acceptance criteria
Research & Planning:
- Codebase context understood
- Implementation plan approved by user
- Existing patterns identified and followed
Implementation:
- Types added/updated
- Core logic implemented
- Tests written following existing patterns
- No scope creep
Final Validation:
- TypeScript compiles
- Linter passes
- Tests pass
- EACH spec requirement verified against code
- No regressions
Multi-Agent Parallelization
Note: Only applicable if parallel agents are supported by host environment.
When to Spawn Subagents:
- 2+ independent implementation tasks (no shared dependencies)
- Distinct subsystems (frontend + backend + tests)
- Separate packages/modules in monorepo
- Parallel research for different parts of the spec
How to Parallelize:
- Use
TodoWriteto create tasks and identify parallelizable work - Use
Tasktool to spawn subagents with specific, scoped goals - Each agent implements independently within defined boundaries
- Merge changes after all agents complete, resolve conflicts
Example:
- Goal: "Implement user authentication with frontend and backend changes"
- Agent 1: Implement backend auth middleware + API routes (
src/api/auth/) - Agent 2: Implement frontend auth hooks + guards (
src/hooks/,src/components/auth/) - Agent 3: Implement tests for both (
tests/auth/) - Merge: Integrate components, verify end-to-end flow
Smart Parallelization Tips:
- Use
TodoWritewith clear task boundaries per agent - Parallelize RESEARCH phase across different spec requirements
- Parallelize IMPLEMENTATION only for truly independent modules
- Keep VALIDATION sequential to catch integration issues
- Define file ownership: each agent has exclusive directories
Anti-patterns:
- Don't parallelize when tasks share state or types being modified
- Don't spawn agents for single-file changes
- Don't parallelize when implementation order matters (e.g., types → logic → integration)
References
Related Skills:
octocode-local-search: Local workspace search & LSP code intelligenceoctocode-research: External GitHub research & package discovery
Implementation Docs:
- Execution Phases:
references/execution-phases.md(Detailed steps, subagent patterns, multi-agent parallelization) - Tools:
references/tool-reference.md(Parameters & Tips) - Workflows:
references/workflow-patterns.md(Research Recipes)