From claude-harness
Initializes Claude Code sessions by migrating legacy harness files to .claude-harness/, creating missing state files like memory rules and config, and preparing GitHub sync.
npx claudepluginhub joshuarweaver/cascade-ai-ml-agents-agent-framework --plugin panayiotism-claude-harnessThis skill uses the workspace's default tool permissions.
Run the initialization script and prepare for a new coding session.
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
Run the initialization script and prepare for a new coding session.
Before anything else, check if legacy root-level harness files need migration:
Check if any of these files exist in the project root:
feature-list.jsonfeature-archive.jsonclaude-progress.jsonworking-context.jsonagent-context.jsonagent-memory.jsoninit.shIf any legacy files exist AND .claude-harness/ directory does NOT exist:
.claude-harness/ directory.claude-harness/:
mv feature-list.json .claude-harness/mv feature-archive.json .claude-harness/mv claude-progress.json .claude-harness/mv working-context.json .claude-harness/mv agent-context.json .claude-harness/mv agent-memory.json .claude-harness/mv init.sh .claude-harness/If .claude-harness/ already exists, check for feature file migration:
feature-list.json OR feature-archive.json exist at root level:
.claude-harness/features/ directory if needed: mkdir -p .claude-harness/features/mv feature-list.json .claude-harness/features/active.json (if exists)mv feature-archive.json .claude-harness/features/archive.json (if exists).claude-harness/ root:
mv .claude-harness/feature-list.json .claude-harness/features/active.json (if exists)mv .claude-harness/feature-archive.json .claude-harness/features/archive.json (if exists)Create missing state files (for plugin updates):
Check if each required state file exists, create with defaults if missing:
.claude-harness/memory/learned/rules.json (if missing):
mkdir -p .claude-harness/memory/learned{
"version": 3,
"lastUpdated": "{ISO timestamp}",
"metadata": {
"totalRules": 0,
"projectSpecific": 0,
"general": 0,
"lastReflection": null
},
"rules": []
}
Report: "Created missing state file: {filename}"
.claude-harness/config.json verification block (if missing acceptance key):
verification object exists but has no acceptance key:
"acceptance": "" to the verification objectNote: Loop state and working context are now session-scoped and created at runtime in .claude-harness/sessions/{session-id}/. Legacy files at .claude-harness/loop-state.json and .claude-harness/working-context.json are no longer created.
FEATURES_FILE=".claude-harness/features/active.json"ARCHIVE_FILE=".claude-harness/features/archive.json"MEMORY_DIR=".claude-harness/memory/"SESSION_DIR=".claude-harness/sessions/{session-id}/"Important: All subsequent phases must use these path variables instead of hardcoded paths.
Session ID: The SessionStart hook automatically generates a unique session ID and creates a session directory at .claude-harness/sessions/{session-id}/. All session-specific state files should use this directory. The session ID is provided in the hook output as sessionId and sessionDir.
OPTIMIZATION: Read all memory layers IN PARALLEL for faster startup.
Initialize session context:
.claude-harness/sessions/{session-id}/)github.owner, github.repo).claude-harness/sessions/{session-id}/context.jsonRead all memory layers IN PARALLEL (single message with multiple Read tool calls):
${FEATURES_FILE} (to identify active feature)${MEMORY_DIR}/procedural/failures.json${MEMORY_DIR}/procedural/successes.json${MEMORY_DIR}/episodic/decisions.json${MEMORY_DIR}/learned/rules.jsonIMPORTANT: Use parallel tool calls - do NOT read these files sequentially. This reduces context compilation time by 30-40%.
Process memory data (after all reads complete):
Failures to avoid:
feature matches or files overlap with relatedFilesrelevantMemory.avoidApproachesSuccessful approaches:
relevantMemory.projectPatternsRecent decisions:
relevantMemory.recentDecisionsWrite compiled context (to session-scoped path):
.claude-harness/sessions/{session-id}/context.json:
{
"version": 3,
"computedAt": "{ISO timestamp}",
"sessionId": "{unique-id}",
"github": {
"owner": "{from SessionStart hook}",
"repo": "{from SessionStart hook}"
},
"activeFeature": "{feature-id or null}",
"relevantMemory": {
"recentDecisions": [{...}],
"projectPatterns": [{...}],
"avoidApproaches": [{...}]
},
"currentTask": {
"description": "{feature description}",
"files": ["{relatedFiles}"],
"acceptanceCriteria": ["{verification}"]
},
"compilationLog": ["Loaded N failures", "Loaded N successes", ...]
}
Display memory summary:
MEMORY CONTEXT COMPILED
Recent decisions: {N} loaded
Success patterns: {N} loaded
Approaches to AVOID: {N} loaded
If avoidApproaches has entries, display prominently:
APPROACHES TO AVOID (from past failures)
- {failure.approach} - {failure.rootCause}
- {failure.approach} - {failure.rootCause}
6.5. Process learned rules (already read in parallel in step 2):
Use data from ${MEMORY_DIR}/learned/rules.json (already loaded)
If file exists and has active rules (rules array with active: true):
Filter rules for current context:
applicability.always is true, ORapplicability.features includes current feature, ORapplicability.filePatterns overlap with feature's relatedFilesAdd rules to working context:
.claude-harness/sessions/{session-id}/context.json:
{
"relevantMemory": {
"recentDecisions": [...],
"projectPatterns": [...],
"avoidApproaches": [...],
"learnedRules": [
{
"id": "rule-001",
"title": "Always use absolute imports",
"description": "Use @/components/... not relative paths",
"scope": "coding-style"
}
]
}
}
Display learned rules if any exist:
LEARNED RULES (from your corrections)
- {rule.title}
- {rule.title}
- {rule.title}
{N} rules active (auto-captured at checkpoint)
If no learned rules exist yet, skip this section (no output)
6.7. Regenerate persistent session briefing at .claude-harness/session-briefing.md:
/start is run manually# Session Briefing
Last updated: {ISO timestamp}
## Active Features
- {id}: {name} [{status}]
{one-line description}
Acceptance: {N} scenarios | Files: {relatedFiles summary}
## Recent Decisions (last 5)
- {decision} ({feature}, {date})
## Approaches to AVOID
- {approach} -> {rootCause} ({feature})
## Learned Rules
- {title}: {description}
## Current Status
Branch: {current branch}
Next steps: {recommended action}
Load working context (if exists):
.claude-harness/working-context.json (legacy) or use compiled contextactiveFeature is set, display prominently:
=== Resuming Work ===
Feature: {activeFeature} - {summary}
Working files: {list workingFiles with roles}
Key decisions: {list decisions}
Next steps: {list nextSteps}
Execute ./.claude-harness/init.sh to see environment status (if it exists)
Read .claude-harness/claude-progress.json for session context
Read ${FEATURES_FILE} to identify next priority
grep -A 5 "passes.*false" ${FEATURES_FILE} to see pending features/claude-harness:checkpoint to auto-archive completed features and reduce file size${ARCHIVE_FILE} to see completed feature count/history.claude-harness/sessions/.recovery/interrupted.jsonINTERRUPTED SESSION DETECTED
Feature: {feature}
TDD Phase: {tddPhase}
Attempt: {attemptAtInterrupt}/{maxAttempts}
Recovery: Will use fresh approach on resume
Resume: /claude-harness:flow {feature}
(Recovery options will be presented on resume)
.claude-harness/sessions/{session-id}/loop-state.json.claude-harness/loops/state.json or .claude-harness/loop-state.jsontype field to determine if this is a feature or fixstatus is "in_progress" and type is "feature":
ACTIVE AGENTIC LOOP
Feature: {feature}
Attempt: {attempt}/{maxAttempts}
Last approach: {history[-1].approach}
Last result: {history[-1].result}
Resume: /claude-harness:flow {feature}
status is "in_progress" and type is "fix":
ACTIVE FIX
Fix: {feature}
Linked to: {linkedTo.featureName} ({linkedTo.featureId})
Attempt: {attempt}/{maxAttempts}
Last approach: {history[-1].approach}
Last result: {history[-1].result}
Resume: /claude-harness:flow {feature}
status is "escalated":
12b. Check pending fixes:
${FEATURES_FILE}fixes array for entries with status != "passing"PENDING FIXES
{fix-id}: {name}
Linked to: {linkedTo.featureName}
Status: {status}
...
.claude-harness/agents/context.json (or legacy agent-context.json) if it existscurrentSession.activeFeature - indicates incomplete orchestrationagentResults for recently completed agent workteamState -- if non-null, display active team:
ACTIVE AGENT TEAM
Team: {teamState.teamName}
Feature: {teamState.feature}
Mode: {teamState.leadMode}
Teammates:
tester: {status}
implementer: {status}
reviewer: {status}
Resume: /claude-harness:flow --team {feature-id}
Note: Agent Teams do not survive session restarts. If teamState exists
but teammates are gone, the flow will detect this and offer to spawn fresh
teammates or fall back to direct implementation./claude-harness:flow {feature-id} to resume"${MEMORY_DIR}/procedural/patterns.json if it existscodebaseInsights.hotspots that may affect current workCheck GitHub MCP connection status
Get GitHub owner/repo (use cached from SessionStart):
github.owner and github.repo from SessionStart hook outputREMOTE_URL=$(git remote get-url origin 2>/dev/null)
# Parse SSH or HTTPS format
OPTIMIZATION: SessionStart hook now parses and caches GitHub repo info. All commands in this session can reuse these values without re-parsing.
Fetch and display GitHub dashboard (using OWNER and REPO):
${FEATURES_FILE}${FEATURES_FILE}:/claude-harness:flow {fix-id}/claude-harness:flow {feature-id}/claude-harness:flow {fix-id}/claude-harness:prd-breakdown @./prd.md to analyze PRD and extract features/claude-harness:flow {feature-id}/claude-harness:flow "description"/claude-harness:flow --fix {feature-id} "bug description"