AgentSkillsCN

harness-initializer

自主编码 Harness 的首轮代理。从 Archon 中读取应用规格,生成详细的功能任务,搭建项目结构,初始化开发环境,并为编码代理创造清晰的交接条件。在项目启动时运行一次。

SKILL.md
--- frontmatter
name: harness-initializer
version: 1.0.0
description: First-session agent for autonomous coding harness. Reads application specification from Archon, generates detailed feature tasks, sets up project structure, initializes development environment, and creates clean handoff for coding agent. Run once at project start.

Harness Initializer Skill

Initialize a new autonomous development harness project. This skill runs in the first session to read the application specification, generate feature tasks, and set up the project foundation.

Triggers

Use this skill when:

  • Starting a new harness project
  • Initializing autonomous development environment
  • Generating tasks from application specification
  • Setting up multi-session development project
  • Keywords: harness init, initialize harness, setup harness, first session, generate tasks, project initialization

Core Mission

This is Session 1 of a multi-session autonomous development project. You must:

  1. Read and understand the application specification from Archon
  2. Generate feature tasks in Archon based on the spec
  3. Set up the project structure and development environment
  4. Create clean handoff for the coding agent that will continue

Step-by-Step Protocol

STEP 1: Get Your Bearings

bash
# 1. Check working directory
pwd

# 2. List existing files
ls -la

# 3. Read harness configuration
cat .harness/config.json

Extract the archon_project_id from the config file.

STEP 2: Query Archon for Project Context

python
# Get project details
project = find_projects(project_id="<PROJECT_ID>")

# Get harness configuration document
config_doc = find_documents(
    project_id="<PROJECT_ID>",
    document_type="guide",
    query="Harness Configuration"
)

# Get application specification document
spec_doc = find_documents(
    project_id="<PROJECT_ID>",
    document_type="spec",
    query="Application Specification"
)

# Get session notes document
notes_doc = find_documents(
    project_id="<PROJECT_ID>",
    document_type="note",
    query="Session Notes"
)

STEP 3: Analyze Application Specification

Read the application specification thoroughly. Identify:

  • Core Features: What are the main capabilities?
  • User Flows: How do users interact with the system?
  • Data Models: What entities and relationships exist?
  • Technical Requirements: Authentication, API design, etc.
  • Dependencies: What features depend on others?

STEP 4: Generate Feature Tasks in Archon

Based on the specification, create detailed tasks in Archon. Follow these guidelines:

Task Granularity

Each task should represent 30 minutes to 4 hours of work.

Task Structure

python
manage_task("create",
    project_id="<PROJECT_ID>",
    title="[Clear, specific feature title]",
    description="""## Feature Description
[What this feature does]

## Requirements
- Requirement 1
- Requirement 2
- Requirement 3

## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3

## Test Steps
1. Step to verify feature works
2. Step to verify edge cases
3. Step to verify error handling

## Dependencies
- Depends on: [Other task IDs if any]

## Notes
[Any additional context]""",
    status="todo",
    task_order=[PRIORITY 1-100],
    feature="[Feature Group]",
    assignee="Coding Agent"
)

Priority Guidelines (task_order)

Priority RangeFeature TypeExamples
95-100Meta/SetupEnvironment, dependencies
85-94FoundationDatabase schema, core models
75-84AuthenticationLogin, registration, sessions
65-74Core APIMain business logic
55-64Secondary APISupporting features
45-54Frontend CoreMain UI components
35-44Frontend SecondaryAdditional UI
25-34IntegrationThird-party services
15-24TestingTest suites, coverage
5-14DocumentationAPI docs, README
1-4PolishError handling, edge cases

Feature Groupings

Use the feature field to group related tasks:

  • Setup
  • Database
  • Authentication
  • Core API
  • Frontend
  • Integration
  • Testing
  • Documentation

STEP 5: Set Up Project Structure

Based on the harness configuration, create the appropriate project structure:

For Node.js/TypeScript:

code
src/
├── components/    # UI components (if frontend)
├── api/           # API routes
├── services/      # Business logic
├── models/        # Data models
├── utils/         # Utilities
├── types/         # TypeScript types
└── db/            # Database (migrations, seeds)
tests/
├── unit/
├── integration/
└── e2e/
docs/

For Python:

code
src/
├── api/           # API routes
├── services/      # Business logic
├── models/        # Data models
├── utils/         # Utilities
└── db/            # Database
tests/
├── unit/
├── integration/
└── e2e/
docs/

STEP 6: Initialize Development Environment

Run the init.sh script and verify it works:

bash
chmod +x init.sh
./init.sh

Or for Windows:

powershell
.\init.ps1

Fix any issues that arise during initialization.

STEP 7: Initialize Git Repository

bash
# Initialize if not already done
git init

# Create .gitignore if not exists
cat > .gitignore << 'EOF'
node_modules/
.env
.env.local
*.pyc
__pycache__/
.pytest_cache/
dist/
build/
.harness/local/
.DS_Store
*.log
EOF

# Make initial commit
git add .
git commit -m "Initial harness setup

- Created project structure
- Initialized development environment
- Generated [X] feature tasks in Archon
- Ready for coding agent

Harness Version: 1.0
Archon Project: <PROJECT_ID>"

STEP 8: Update Session Notes in Archon

python
manage_document("update",
    project_id="<PROJECT_ID>",
    document_id="<SESSION_NOTES_DOC_ID>",
    content={
        "sessions": [
            {
                "session_number": 1,
                "agent": "harness-initializer",
                "date": "<TIMESTAMP>",
                "status": "completed",
                "completed": [
                    "Read and analyzed application specification",
                    "Generated [X] feature tasks in Archon",
                    "Created project directory structure",
                    "Initialized git repository",
                    "Environment setup complete"
                ],
                "blockers": [],
                "notes": [
                    "All tasks ordered by priority",
                    "Ready for coding agent to begin"
                ]
            }
        ],
        "current_focus": "Ready for first feature implementation",
        "blockers": [],
        "next_steps": [
            "Start with highest priority TODO task",
            "Implement one feature at a time",
            "Run tests after each feature"
        ],
        "decisions": [
            # Any decisions made during initialization
        ]
    }
)

STEP 9: Update META Task

python
manage_task("update",
    task_id="<META_TASK_ID>",
    description="""## Current Session Status
- Session: 1 (Initialization)
- Agent: harness-initializer
- Status: Complete

## Session Summary
- Generated [X] feature tasks from specification
- Project structure created
- Environment initialized
- Git repository ready

## Next Session
- Agent: harness-coder
- Start with: [Highest priority task title]
- Task ID: [TASK_ID]

## Quick Stats
- Total Tasks: [X]
- Completed: 0
- In Progress: 0
- Remaining: [X]

---
Last Updated: <TIMESTAMP>"""
)

STEP 10: Mark Initialization Task Complete

python
manage_task("update",
    task_id="<INIT_TASK_ID>",
    status="done"
)

Output Summary

Before ending, display:

markdown
## Initialization Complete

### Tasks Generated
- **Total Features**: [X]
- **High Priority (75+)**: [Y]
- **Medium Priority (25-74)**: [Z]
- **Low Priority (1-24)**: [W]

### Feature Groups
| Group | Task Count |
|-------|------------|
| Setup | X |
| Database | X |
| Authentication | X |
| Core API | X |
| Frontend | X |
| Testing | X |
| Documentation | X |

### Project Structure
[Show created directories]

### Git Status
- Initial commit created
- [X] files tracked

### Archon Updates
- Session Notes updated
- META task updated
- Initialization task marked done

---

## Ready for Coding Agent

Use the harness-coder skill to start the first coding session.

First task: **[Task Title]** (Priority: [X])

Critical Rules

  1. NEVER skip task generation - Every feature in the spec needs a task
  2. NEVER create overly broad tasks - 30 min to 4 hours max
  3. ALWAYS include acceptance criteria - Tasks must be testable
  4. ALWAYS order by dependencies - Foundation before features
  5. ALWAYS update Archon - Session notes and META task
  6. ALWAYS commit to git - Clean state for next session
  7. ALWAYS verify environment works - Run init.sh successfully

Handling Issues

If spec is unclear:

Create tasks for what you understand, and create a "Clarification Needed" task with questions for the user.

If environment fails to initialize:

  1. Document the error
  2. Create a "Fix Environment" task with high priority
  3. Update session notes with the blocker
  4. Still commit what you have

If Archon is slow:

  • Batch task creation where possible
  • Log progress to console
  • Continue even if some operations are slow