agentleFS
simtransformasimtransforma/HAOS-CC-Model/skills/long-running-agent/SKILL.md

long-running-agent

Skill1 starsChanged 50 days agoMITView on GitHub

This skill should be used when developing complex projects that span multiple sessions or context windows. It implements the Long-Running Agent Protocol based on Anthropic's recommended practices for maintaining progress across sessions using SubAgents with isolated context windows, progress tracking files, and incremental feature development.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 20 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 20

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When delegating tasks to SubAgents for isolated execution

    line 14
  2. Distinctive:

    When previous sessions lost context or progress

    line 15
  3. Very specific:

    All progress is tracked in the .claude/ directory:

    line 30
  4. Distinctive:

    Before any development work, execute this orientation sequence:

    line 44
  5. Very specific:

    If .claude/ exists: Read progress files

    line 51
  6. Very specific:

    Read .claude/progress.md to understand session history

    line 52
  7. Very specific:

    Read .claude/features.xml to see pending features

    line 53
  8. Distinctive:

    Check git log --oneline -10 for recent commits

    line 54
  9. Very specific:

    Run scripts/init_project.py or manually create structure

    line 57
  10. Distinctive:

    Create initial progress.md with session #1

    line 59
  11. Distinctive:

    Run development server if applicable

    line 62
  12. Distinctive:

    If bugs found, fix BEFORE starting new work

    line 64
  13. Distinctive:

    Before delegating to SubAgent, prepare the task file:

    line 72
  14. Distinctive:

    When SubAgent responds with completion status:

    line 123
  15. Very specific:

    Update .claude/features.xml - change status to "complete"

    line 126
  16. Very specific:

    Update .claude/progress.md - log the completion

    line 127
  17. Distinctive:

    Update task and retry OR select different feature

    line 135
  18. Distinctive:

    Before ending any session:

    line 139
  19. Distinctive:

    Ensure code compiles and runs

    line 141
  20. Very specific:

    Update .claude/progress.md with session summary

    line 143
  21. Distinctive:

    Document next steps clearly

    line 144
  22. Distinctive:

    Leave environment in clean state

    line 145
  23. Distinctive:

    Remove or edit feature descriptions

    line 175
  24. Distinctive:

    Read progress files before any work

    line 179
  25. Distinctive:

    Test thoroughly before marking complete

    line 181
  26. Distinctive:

    Commit after each completed feature

    line 182
  27. Distinctive:

    Update progress files after each task

    line 183
  28. Distinctive:

    Leave code in functional state

    line 184

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Long-Running Agent Protocol

This skill provides a systematic approach for developing complex projects across multiple Claude sessions, preventing context loss and maintaining consistent progress.

When to Use This Skill

  • Projects expected to take multiple sessions to complete
  • Complex applications with many features (50+ features)
  • When delegating tasks to SubAgents for isolated execution
  • When previous sessions lost context or progress
  • Full-stack applications, CLI tools, or any multi-component project

Core Concepts

Master Agent vs SubAgent Architecture

The protocol uses two agent roles:

Master Agent (You): Orchestrates the project, maintains progress files, delegates tasks, and consolidates results.

SubAgents: Execute isolated tasks with their own context window, preventing hallucination. Each SubAgent receives a specific task and returns completion status.

Progress Tracking Files

All progress is tracked in the .claude/ directory:

project/
├── .claude/
│   ├── progress.md          # Session history and status
│   ├── features.xml         # Feature list with status
│   ├── current-task.md      # Task for SubAgent execution
│   └── session-log.md       # Current session activity log

Protocol Workflow

Phase 1: Session Initialization (Always Execute First)

Before any development work, execute this orientation sequence:

  1. Check for existing progress structure
   ls -la .claude/
  1. If .claude/ exists: Read progress files
    • Read .claude/progress.md to understand session history
    • Read .claude/features.xml to see pending features
    • Check git log --oneline -10 for recent commits
  2. If .claude/ does not exist: Initialize project
    • Run scripts/init_project.py or manually create structure
    • Generate comprehensive feature list (minimum 50 features)
    • Create initial progress.md with session #1
  3. Validate environment
    • Run development server if applicable
    • Execute basic smoke test
    • If bugs found, fix BEFORE starting new work
  4. Select next task
    • Choose ONE feature with status="pending" from features.xml
    • Prioritize by priority attribute (high → medium → low)

Phase 2: Task Preparation

Before delegating to SubAgent, prepare the task file:

  1. Write .claude/current-task.md with:
    • Feature ID and description
    • Acceptance criteria (checkboxes)
    • Files to modify
    • Technical context
    • Completion signal phrase
  2. Example task file format:
   # Current Task

   ## Feature: FEAT-XXX
   **Description**: [Clear description]

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

   ## Files to Modify
   - path/to/file1.ts
   - path/to/file2.ts

   ## Technical Context
   [Relevant technical details]

   ## Completion Signal
   When all criteria are met, respond: **TASK_COMPLETE**
   If blocked, respond: **TASK_BLOCKED: [reason]**

Phase 3: SubAgent Execution

Delegate the task to a SubAgent with this prompt pattern:

You are a Development SubAgent. Read .claude/current-task.md and execute the described task.

Rules:
- Work incrementally, testing each change
- Do not modify files outside the specified list
- Do not mark criteria complete until verified
- Respond TASK_COMPLETE when all criteria pass
- Respond TASK_BLOCKED: [reason] if you cannot proceed

The SubAgent works in isolation with its own context window, preventing hallucination from accumulated context.

Phase 4: Consolidation (After SubAgent Returns)

When SubAgent responds with completion status:

If TASK_COMPLETE:

  1. Update .claude/features.xml - change status to "complete"
  2. Update .claude/progress.md - log the completion
  3. Commit changes: git add -A && git commit -m "Feature: FEAT-XXX - [description]"
  4. Update .claude/session-log.md
  5. Return to Phase 2 for next feature OR end session

If TASK_BLOCKED:

  1. Log the blocker in .claude/session-log.md
  2. Decide: break down task further, skip, or request user input
  3. Update task and retry OR select different feature

Phase 5: Session End

Before ending any session:

  1. Ensure code compiles and runs
  2. Make final git commit if pending changes
  3. Update .claude/progress.md with session summary
  4. Document next steps clearly
  5. Leave environment in clean state

File Formats

progress.md Format

Reference references/progress-template.md for the complete template. Key sections:

  • Current session number and date
  • Features completed count
  • Session history summaries
  • Known issues
  • Next priorities

features.xml Format

Reference references/features-template.xml for the complete template. Key attributes:

  • id: Unique feature identifier (FEAT-XXX)
  • status: pending | in-progress | complete | blocked
  • priority: high | medium | low
  • session: Session number when completed

Critical Rules

NEVER DO:

  • Implement multiple features simultaneously
  • Mark features complete without testing
  • Skip the orientation phase
  • Ignore existing bugs to add new features
  • Remove or edit feature descriptions
  • End session with broken code

ALWAYS DO:

  • Read progress files before any work
  • Work on ONE feature at a time
  • Test thoroughly before marking complete
  • Commit after each completed feature
  • Update progress files after each task
  • Leave code in functional state

Integrating with CLAUDE.md

To make this protocol permanent for a project, append the contents of assets/claude-md-append.md to the project's CLAUDE.md file. This ensures the protocol is followed in every session automatically.

Initialization

For new projects, run the initialization script:

python scripts/init_project.py --project-name "My Project" --description "Project description"

This creates the .claude/ directory structure and generates an initial feature list based on the project description.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.