feat: integrate agent-manager module with KiloCode workflows

- Move agent-manager from packages/opencode/ to src/kilocode/
- Add Gitea client for pipeline logging
- Add pipeline-runner for workflow orchestration
- Create slash commands: /pipeline, /status, /evaluate
- Update AGENTS.md with workflow documentation
- Update README.md with KiloCode integration details
- Add package.json and tsconfig.json for TypeScript compilation
- Remove duplicate files from packages/opencode/

This enables:
- /pipeline <issue> - run full agent pipeline with Gitea logging
- Direct agent invocation via @mention
- Performance tracking and prompt optimization
This commit is contained in:
swp
2026-04-04 01:11:06 +01:00
parent 4a69c5323b
commit 35bbdcb08f
21 changed files with 1478 additions and 74 deletions

View File

@@ -0,0 +1,58 @@
---
description: Evaluate agent performance for completed issue
mode: subagent
model: ollama-cloud/gpt-oss:120b
color: "#F59E0B"
---
# Evaluate Command
Generate performance evaluation report for a completed pipeline run.
## Usage
```
/evaluate <issue-number>
```
## Process
1. Fetch issue comments
2. Parse agent execution logs
3. Calculate scores per agent
4. Generate recommendations
5. Post evaluation to Gitea
## Scoring Criteria
| Criterion | Weight |
|-----------|--------|
| Code Quality | 30% |
| Test Coverage | 20% |
| Review Iterations | 20% |
| Time to Complete | 15% |
| Security Issues | 15% |
## Output Format
```markdown
## 🟢 Pipeline Evaluation Report
**Issue**: #42
**Overall Score**: 8.2/10
**Duration**: 2.5h
**Iterations**: 2
### Agent Scores
| Agent | Score | Notes |
|-------|-------|-------|
| 🟢 requirement-refiner | 9/10 | Clear acceptance criteria |
| 🟢 lead-developer | 8/10 | Clean implementation |
| 🟡 code-skeptic | 7/10 | Found 2 minor issues |
| 🟢 the-fixer | 9/10 | Fixed issues quickly |
### Recommendations
- Consider optimizing code-skeptic prompt (score < 8)
```

139
.kilo/commands/pipeline.md Normal file
View File

@@ -0,0 +1,139 @@
---
description: Run full agent pipeline for an issue with Gitea logging
---
# Pipeline Workflow
You are orchestrating the full agent pipeline for issue #{issue_number}. Execute each step sequentially, logging progress to Gitea.
## Parameters
- `issue_number`: The issue number to process (ask if not provided)
## Step 1: Fetch Issue Context
1. Read the issue from Gitea using `bash`:
```bash
gh issue view {issue_number} --json title,body,labels,assignees
```
2. Parse the issue body for:
- Acceptance criteria (checkboxes)
- Referenced files
- Current status label
## Step 2: Check for Duplicates
1. Use `grep` to search git history for similar issues:
```bash
git log --all --oneline --grep="{keywords from title}"
```
2. Report findings as Gitea comment
## Step 3: Route Based on Status
Based on the issue status label, invoke the appropriate agent using Task tool:
| Status Label | Agent to Invoke |
|-------------|-----------------|
| `status: new` | `@requirement-refiner` |
| `status: planned` | `@history-miner` |
| `status: researching` | `@system-analyst` |
| `status: designed` | `@sdet-engineer` |
| `status: testing` | `@lead-developer` |
| `status: implementing` | `@code-skeptic` |
| `status: reviewing` | `@performance-engineer` |
| `status: fixing` | `@the-fixer` |
| `status: releasing` | `@release-manager` |
| `status: evaluated` | `@prompt-optimizer` |
## Step 4: Execute Agent Task
1. Use Task tool to invoke the agent:
```
Use the Task tool with subagent_type: "lead-developer" (or appropriate agent)
prompt: "Implement the following: {issue details}"
```
2. After agent completes, check result:
- If successful → proceed to next agent in workflow
- If issues found → route to `@the-fixer`
## Step 5: Log Progress to Gitea
After each agent completes, post comment:
```bash
gh issue comment {issue_number} --body "## ✅ {agent_name} completed
**Score**: {score}/10
**Duration**: {duration}
**Next**: {next_agent}
{agent_notes}"
```
## Step 6: Update Status Label
```bash
gh issue edit {issue_number} --remove-label "status: {old_status}" --add-label "status: {new_status}"
```
## Step 7: Continue Pipeline
Loop through steps 3-6 until status is `status: completed`.
## Step 8: Generate Evaluation Report
When pipeline completes, generate final report:
```markdown
## 🟢 Pipeline Evaluation Report
**Issue**: #{issue_number}
**Overall Score**: {average}/10
**Duration**: {total_hours}h
**Iterations**: {count}
### Agent Scores
| Agent | Score | Notes |
|-------|-------|-------|
| {agent} | {score}/10 | {notes} |
### Recommendations
- {recommendation_1}
- {recommendation_2}
```
## Workflow Graph
```
new → requirement-refiner → planned
planned → history-miner → researching
researching → system-analyst → designed
designed → sdet-engineer → testing
testing → lead-developer → implementing
implementing → code-skeptic → reviewing
reviewing → performance-engineer → perf-check
perf-check → security-auditor → security-check
security-check → release-manager → releasing
releasing → evaluator → evaluated
evaluated → prompt-optimizer → completed
```
On failure at any step → route to `the-fixer` → back to `code-skeptic`
## Environment
Required environment variables:
```
GITEA_API_URL=https://git.softuniq.eu/api/v1
GITEA_TOKEN=your-token
```
## Error Handling
If any step fails:
1. Post error comment to issue
2. Add label `status: blocked`
3. Ask user for guidance using `question` tool

41
.kilo/commands/status.md Normal file
View File

@@ -0,0 +1,41 @@
---
description: Check pipeline status for an issue
mode: subagent
model: qwen/qwen3.6-plus:free
color: "#3B82F6"
---
# Status Command
Check current pipeline status for an issue.
## Usage
```
/status <issue-number>
```
## Output
```
📊 Issue #42 Pipeline Status
Current State: implementing
Current Agent: @LeadDeveloper
Progress:
✅ requirement-refiner (completed, score: 9)
✅ history-miner (completed, score: 8)
✅ system-analyst (completed, score: 8)
✅ sdet-engineer (completed, tests written)
🔄 lead-developer (in progress)
Next Steps:
1. Complete implementation
2. Code review by @CodeSkeptic
3. Performance check
4. Security audit
5. Release
Estimated Completion: 1.5h
```

View File

@@ -3,5 +3,17 @@
"instructions": [".kilo/rules/*.md"],
"skills": {
"paths": [".kilo/skills"]
},
"agent": {
"pipeline-runner": {
"description": "Runs agent pipeline with Gitea logging",
"mode": "subagent",
"permission": {
"read": "allow",
"write": "allow",
"bash": "allow",
"task": "allow"
}
}
}
}