Loading...
Loading...
Harness Engineering Phase 3: Establish cross-session state management to solve the problem of agents forgetting previous conversations. Create three files: tasks.json (task list), progress.md (progress record), and init.sh (environment initialization script). Use this skill immediately when the user says phrases like "establish task management", "make agent remember progress", "create tasks.json", "maintain state across sessions", "agent doesn't remember what was done last time", "create progress file", or "initialize state management". Prerequisites: harness-step1 and harness-step2 have been completed (the project has AGENTS.md and docs/ knowledge base).
npx skill4agent add simbajigege/book2skills harness-step3-session-managementinit.shtasks.jsonprogress.mdinit.sh# Read scripts in package.json (Node.js projects)
cat package.json 2>/dev/null | grep -A 20 '"scripts"'
# Or read Makefile (multi-language projects)
cat Makefile 2>/dev/null | head -40
# Or read pyproject.toml (Python projects)
cat pyproject.toml 2>/dev/null | grep -A 20 '\[tool.poetry.scripts\]'
# Confirm startup commands in existing AGENTS.md
grep -A 5 '启动命令\|start\|dev\|run' AGENTS.md 2>/dev/nullinit.shinit.sh#!/bin/bash
# init.sh — Run at the start of each session
# Verify that the development environment is in a working state
set -e # Stop if any step fails
echo "=== Checking Environment ==="
# 1. Confirm in the correct directory
echo "Working Directory: $(pwd)"
# 2. Install dependencies (if node_modules does not exist)
# [Choose based on tech stack, the following is an example]
# Node.js:
if [ ! -d "node_modules" ]; then
echo "Installing dependencies..."
npm install
fi
# 3. Smoke test: Verify the project can start normally
# [Write according to actual project situation, the goal is to verify basic functionality in the fastest way]
# Example: Run the fastest test
# npm run test -- --testPathPattern=smoke 2>/dev/null || echo "Warning: Smoke test failed, please fix first"
echo "=== Environment check completed, ready to start working ==="
echo "Tip: Run 'git log --oneline -10' to view recent work history"bash init.shtasks.json{
"project": "[Project Name]",
"last_updated": "[Today's Date, Format YYYY-MM-DD]",
"current_focus": "[The most important thing right now, one sentence]",
"tasks": [
{
"id": "[Module Abbreviation]-[Serial Number]",
"title": "[Task Title]",
"description": "[What to do specifically, 1-3 sentences]",
"status": "pending | in_progress | done | blocked",
"priority": "high | medium | low",
"blocked_by": "[Blocking reason, only fill in when status is blocked]",
"verify": "[How to verify this task is completed]",
"requires_eval": false
}
]
}| Field | Required | Explanation |
|---|---|---|
| Required | Module abbreviation + serial number, e.g., |
| Required | Task title, one sentence |
| Required | What to do specifically, 1-3 sentences |
| Required | Initial value is |
| Required | |
| Only when blocked | Blocking reason |
| Required | How to verify completion, must be executable steps (commands or operations) |
| Required | Whether independent Evaluator review is needed, default |
requires_evaltruefalsedocs/exec-plans/active/docs/exec-plans/tech-debt-tracker.mdverifypendingI have scanned the project and am ready to create the task list. Please tell me: What are the 3-5 tasks you most want to advance right now? Just describe each task in one sentence.
progress.md# Project Progress Record
> After completing tasks in each session, append records at the top. Do not delete history.
> Format: ## [Date] [Task Name]
---
## [Today's Date] Initialize Harness
- Completed harness-step1: Established docs/ skeleton
- Completed harness-step2: Filled knowledge base content
- Completed harness-step3: Established state management
- Number of initial tasks in tasks.json: [N]
- Next start here: Read tasks.json, select tasks with priority=high and status=pending to startAGENTS.mdAGENTS.md### When adding tasks, you must:
1. Fill in all fields in tasks.json, cannot omit
2. Judge `requires_eval` against the following criteria, cannot default to false without thinking:
- New features / involving security permissions / modifying more than 3 files / refactoring → true
- Pure bug fixes / document updates / configuration adjustments → false
### After completing each task, you must execute in order:
1. Perform the verification steps described in the `verify` field of the task in tasks.json
2. If the task's `requires_eval` is `true`: Fill in `sprint_output.md`, wait for Evaluator review approval before marking as `done`
If the task's `requires_eval` is `false`: Mark as `done` once verification passes
3. git commit, format: `type(scope): What was done, any leftovers (if applicable)`
4. Append this session's record at the top of `progress.md`
**Prohibited**: Skipping the verify step and judging task completion on your own.
**Prohibited**: Setting `requires_eval` to false without judgment.# Simulate the operation sequence when an agent starts a new session
echo "=== Simulating New Session Startup ==="
# 1. Run init.sh
bash init.sh
# 2. Check git log
git log --oneline -10
# 3. Read progress.md (Confirm the file exists and is readable)
head -20 progress.md
# 4. Read tasks.json (Confirm correct format)
cat tasks.json | python3 -m json.tool > /dev/null && echo "tasks.json format is correct" || echo "tasks.json format is incorrect"init.shtasks.jsonverifyrequires_evalrequires_evalprogress.mdAGENTS.mdinit.shtasks.jsonprogress.mdNow you can hand the project over to Claude Code. It will automatically read these three files + git log each time it starts, and resume work status. You don't need to explain "where we left off last time" every time.
tasks.jsonrequires_evalinit.shharness-step4-linterharness-step5-evaluator