WIP: boostrapping opencode for use with at least GLM agents

This commit is contained in:
2026-03-04 15:56:00 -05:00
parent 01b3c26653
commit c17698ed31
17 changed files with 1087 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
---
description: Resume or start track implementation following TDD protocol
agent: tier2-tech-lead
---
# /conductor-implement
Resume or start implementation of the active track following TDD protocol.
## Prerequisites
- Run `/conductor-setup` first to load context
- Ensure a track is active (has `[~]` tasks)
## Implementation Protocol
1. **Identify Current Task:**
- Read active track's `plan.md`
- Find the first `[~]` (in-progress) or `[ ]` (pending) task
- If phase has no pending tasks, move to next phase
2. **Research Phase (MANDATORY):**
Before implementing, use tools to understand context:
- `py_get_code_outline` on target files
- `py_get_skeleton` on dependencies
- `grep` for related patterns
- `get_git_diff` for recent changes
- Audit `__init__` methods for existing state
3. **TDD Cycle:**
### Red Phase (Write Failing Tests)
- Stage current progress: `git add .`
- Delegate test creation to @tier3-worker:
```
@tier3-worker
Write tests for: [task description]
WHERE: tests/test_file.py:line-range
WHAT: Test [specific functionality]
HOW: Use pytest, assert [expected behavior]
SAFETY: [thread-safety constraints]
Use 1-space indentation.
```
- Run tests: `uv run pytest tests/test_file.py -v`
- **CONFIRM TESTS FAIL** - this is the Red phase
### Green Phase (Implement to Pass)
- Stage current progress: `git add .`
- Delegate implementation to @tier3-worker:
```
@tier3-worker
Implement: [task description]
WHERE: src/file.py:line-range
WHAT: [specific change]
HOW: [API calls, patterns to use]
SAFETY: [thread-safety constraints]
Use 1-space indentation.
```
- Run tests: `uv run pytest tests/test_file.py -v`
- **CONFIRM TESTS PASS** - this is the Green phase
### Refactor Phase (Optional)
- With passing tests, refactor for clarity
- Re-run tests to verify
4. **Commit Protocol (ATOMIC PER-TASK):**
```powershell
git add .
git commit -m "feat(scope): description"
$hash = git log -1 --format="%H"
git notes add -m "Task: [summary]" $hash
```
- Update `plan.md`: Change `[~]` to `[x]` with commit SHA
- Commit plan update: `git add plan.md && git commit -m "conductor(plan): Mark task complete"`
5. **Repeat for Next Task**
## Error Handling
If tests fail after Green phase:
- Delegate analysis to @tier4-qa:
```
@tier4-qa
Analyze this test failure:
[test output]
DO NOT fix - provide analysis only.
```
- Maximum 2 fix attempts before escalating to user
## Phase Completion
When all tasks in a phase are `[x]`:
- Run `/conductor-verify` for checkpoint

View File

@@ -0,0 +1,118 @@
---
description: Create a new conductor track with spec, plan, and metadata
agent: tier1-orchestrator
subtask: true
---
# /conductor-new-track
Create a new conductor track following the Surgical Methodology.
## Arguments
$ARGUMENTS - Track name and brief description
## Protocol
1. **Audit Before Specifying (MANDATORY):**
Before writing any spec, research the existing codebase:
- Use `py_get_code_outline` on relevant files
- Use `py_get_definition` on target classes
- Use `grep` to find related patterns
- Use `get_git_diff` to understand recent changes
Document findings in a "Current State Audit" section.
2. **Generate Track ID:**
Format: `{name}_{YYYYMMDD}`
Example: `async_tool_execution_20260303`
3. **Create Track Directory:**
`conductor/tracks/{track_id}/`
4. **Create spec.md:**
```markdown
# Track Specification: {Title}
## Overview
[One-paragraph description]
## Current State Audit (as of {commit_sha})
### Already Implemented (DO NOT re-implement)
- [Existing feature with file:line reference]
### Gaps to Fill (This Track's Scope)
- [What's missing that this track will address]
## Goals
- [Specific, measurable goals]
## Functional Requirements
- [Detailed requirements]
## Non-Functional Requirements
- [Performance, security, etc.]
## Architecture Reference
- docs/guide_architecture.md#section
- docs/guide_tools.md#section
## Out of Scope
- [What this track will NOT do]
```
5. **Create plan.md:**
```markdown
# Implementation Plan: {Title}
## Phase 1: {Name}
Focus: {One-sentence scope}
- [ ] Task 1.1: {Surgical description with file:line refs}
- [ ] Task 1.2: ...
- [ ] Task 1.N: Write tests for Phase 1 changes
- [ ] Task 1.X: Conductor - User Manual Verification
## Phase 2: {Name}
...
```
6. **Create metadata.json:**
```json
{
"id": "{track_id}",
"title": "{title}",
"type": "feature|fix|refactor|docs",
"status": "planned",
"priority": "high|medium|low",
"created": "{YYYY-MM-DD}",
"depends_on": [],
"blocks": []
}
```
7. **Update tracks.md:**
Add entry to `conductor/tracks.md` registry.
8. **Report:**
```
## Track Created
**ID:** {track_id}
**Location:** conductor/tracks/{track_id}/
**Files Created:**
- spec.md
- plan.md
- metadata.json
**Next Steps:**
1. Review spec.md for completeness
2. Run `/conductor-implement` to begin execution
```
## Surgical Methodology Checklist
- [ ] Audited existing code before writing spec
- [ ] Documented existing implementations with file:line refs
- [ ] Framed requirements as gaps, not features
- [ ] Tasks are worker-ready (WHERE/WHAT/HOW/SAFETY)
- [ ] Referenced architecture docs
- [ ] Mapped dependencies in metadata

View File

@@ -0,0 +1,47 @@
---
description: Initialize conductor context — read product docs, verify structure, report readiness
agent: tier1-orchestrator
subtask: true
---
# /conductor-setup
Bootstrap the session with full conductor context. Run this at session start.
## Steps
1. **Read Core Documents:**
- `conductor/index.md` — navigation hub
- `conductor/product.md` — product vision
- `conductor/product-guidelines.md` — UX/code standards
- `conductor/tech-stack.md` — technology constraints
- `conductor/workflow.md` — task lifecycle (skim; reference during implementation)
2. **Check Active Tracks:**
- List all directories in `conductor/tracks/`
- Read each `metadata.json` for status
- Read each `plan.md` for current task state
- Identify the track with `[~]` in-progress tasks
3. **Check Session Context:**
- Read `TASKS.md` if it exists — check for IN_PROGRESS or BLOCKED tasks
- Read last 3 entries in `JOURNAL.md` for recent activity
- Run `git log --oneline -10` for recent commits
4. **Report Readiness:**
Present a session startup summary:
```
## Session Ready
**Active Track:** {track name} — Phase {N}, Task: {current task description}
**Recent Activity:** {last journal entry title}
**Last Commit:** {git log -1 oneline}
Ready to:
- `/conductor-implement` — resume active track
- `/conductor-status` — full status overview
- `/conductor-new-track` — start new work
```
## Important
- This is READ-ONLY — do not modify files

View File

@@ -0,0 +1,59 @@
---
description: Display full status of all conductor tracks and tasks
agent: tier1-orchestrator
subtask: true
---
# /conductor-status
Display comprehensive status of the conductor system.
## Steps
1. **Read Track Index:**
- `conductor/tracks.md` — track registry
- `conductor/index.md` — navigation hub
2. **Scan All Tracks:**
For each track in `conductor/tracks/`:
- Read `metadata.json` for status and timestamps
- Read `plan.md` for task progress
- Count completed vs total tasks
3. **Check TASKS.md:**
- List IN_PROGRESS tasks
- List BLOCKED tasks
- List pending tasks by priority
4. **Recent Activity:**
- `git log --oneline -5`
- Last 2 entries from `JOURNAL.md`
5. **Report Format:**
```
## Conductor Status
### Active Tracks
| Track | Status | Progress | Current Task |
|-------|--------|----------|--------------|
| ... | ... | N/M tasks | ... |
### Task Registry (TASKS.md)
**In Progress:**
- [ ] Task description
**Blocked:**
- [ ] Task description (reason)
### Recent Commits
- `abc1234` commit message
### Recent Journal
- YYYY-MM-DD: Entry title
### Recommendations
- [Next action suggestion]
```
## Important
- This is READ-ONLY — do not modify files

View File

@@ -0,0 +1,80 @@
---
description: Verify phase completion and create checkpoint commit
agent: tier2-tech-lead
---
# /conductor-verify
Execute phase completion verification and create checkpoint.
## Prerequisites
- All tasks in the current phase must be marked `[x]`
- All changes must be committed
## Verification Protocol
1. **Announce Protocol Start:**
Inform user that phase verification has begun.
2. **Determine Phase Scope:**
- Find previous phase checkpoint SHA in `plan.md`
- If no previous checkpoint, scope is all changes since first commit
3. **List Changed Files:**
```powershell
git diff --name-only <previous_checkpoint_sha> HEAD
```
4. **Verify Test Coverage:**
For each code file changed (exclude `.json`, `.md`, `.yaml`):
- Check if corresponding test file exists
- If missing, create test file via @tier3-worker
5. **Execute Tests in Batches:**
**CRITICAL**: Do NOT run full suite. Run max 4 test files at a time.
Announce command before execution:
```
I will now run: uv run pytest tests/test_file1.py tests/test_file2.py -v
```
If tests fail with large output:
- Pipe to log file
- Delegate analysis to @tier4-qa
- Maximum 2 fix attempts before escalating
6. **Present Results:**
```
## Phase Verification Results
**Phase:** {phase name}
**Files Changed:** {count}
**Tests Run:** {count}
**Tests Passed:** {count}
**Tests Failed:** {count}
[Detailed results or failure analysis]
```
7. **Await User Confirmation:**
**PAUSE** and wait for explicit user approval before proceeding.
8. **Create Checkpoint:**
```powershell
git add .
git commit --allow-empty -m "conductor(checkpoint): Phase {N} complete"
$hash = git log -1 --format="%H"
git notes add -m "Verification: [report summary]" $hash
```
9. **Update Plan:**
- Add `[checkpoint: {sha}]` to phase heading in `plan.md`
- Commit: `git add plan.md && git commit -m "conductor(plan): Mark phase complete"`
10. **Announce Completion:**
Inform user that phase is complete with checkpoint created.
## Error Handling
- If any verification fails: HALT and present logs
- Do NOT proceed without user confirmation
- Maximum 2 fix attempts per failure

View File

@@ -0,0 +1,11 @@
---
description: Invoke Tier 1 Orchestrator for product alignment and track initialization
agent: tier1-orchestrator
subtask: true
---
$ARGUMENTS
---
Invoke the Tier 1 Orchestrator with the above context. Focus on product alignment, high-level planning, and track initialization. Follow the Surgical Methodology: audit existing code before specifying, identify gaps not features, and write worker-ready tasks.

View File

@@ -0,0 +1,10 @@
---
description: Invoke Tier 2 Tech Lead for architectural design and track execution
agent: tier2-tech-lead
---
$ARGUMENTS
---
Invoke the Tier 2 Tech Lead with the above context. Follow TDD protocol (Red -> Green -> Refactor), delegate implementation to Tier 3 Workers, and maintain persistent memory throughout track execution. Commit atomically per-task.

View File

@@ -0,0 +1,10 @@
---
description: Invoke Tier 3 Worker for surgical code implementation
agent: tier3-worker
---
$ARGUMENTS
---
Invoke the Tier 3 Worker with the above task. Operate statelessly with context amnesia. Implement the specified change exactly as described. Use 1-space indentation for Python code. Do NOT add comments unless requested.

View File

@@ -0,0 +1,10 @@
---
description: Invoke Tier 4 QA for error analysis and diagnostics
agent: tier4-qa
---
$ARGUMENTS
---
Invoke the Tier 4 QA Agent with the above context. Analyze errors, summarize logs, or verify tests. Provide root cause analysis with file:line evidence. DO NOT implement fixes - analysis only.