shynlee04/hivemind-plugin/hm-l3-hivemind-state-reference

Claude Code and agent skill by shynlee04/hivemind-plugin

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Documents the complete `.hivemind/` state root structure — session continuity, delegation records, event journals, workflow config, planning persistence, and recovery paths. Use when navigating `.hivemind/` directories, reading/writing state files, recovering from interrupted sessions, understanding delegation records, or consuming Hivemind runtime state. NOT for mutating state directly — this is a read-only reference for hm-* agents.

Install

npx vskill@latest install shynlee04/hivemind-plugin/hm-l3-hivemind-state-reference

SKILL.md

Overview

Complete reference for the .hivemind/ state root — the canonical deep module persistence layer defined by Q6 State Root Separation (locked 2026-04-25). All Hivemind runtime state (session journals, delegation records, continuity, planning artifacts) writes to .hivemind/ at project root. .opencode/ is ONLY for OpenCode primitives (agents, commands, skills) — no runtime state is stored there.

This skill is read-only reference for hm-* agents. You consume state, you don't mutate it. For mutation, use the Hivemind tools (delegate-task, delegation-status, session-journal-export, configure-primitive, session-patch).

.hivemind/ Directory Structure

.hivemind/
├── archive/ # Archived session artifacts
├── cycle2/ # Cycle 2 persistent data
├── daily-notes/ # Session daily notes
├── event-tracker/ # Session event journals (JSON + Markdown)
│ └── ses_XXXX.{json,md} # One pair per session
├── journal/ # Session journals (YYYY-MM-DD.jsonl)
├── lineage/ # Execution lineage records
├── research/ # Deep research cached artifacts
└── state/ # Core state persistence ← PRIMARY
├── session-continuity.json # Cross-session state (ContinuityStoreFile)
├── delegations.json # Active/completed delegation records
├── config-workflows.json # Workflow configuration state
├── SESSION-STATE.md # WAL-protocol session state (markdown)
├── task_plan.md # Planning-with-files task plan
├── findings.md # Planning-with-files findings
├── progress.md # Planning-with-files progress
├── session-context-prompt.md # Session context prompt storage
├── baseline-*.md # Audit baselines (timestamped)
├── planning/ # Task persistence (hm-planning-persistence)
│ └── stack-skill-reset-*/ # Per-reset planning state
└── .patches/ # Patch history

Core State Files — Contracts

1. session-continuity.json — Cross-Session State

Format: ContinuityStoreFile (versioned JSON object)

Schema:

typescript
ContinuityStoreFile = {
version: number // Schema version (currently 1)
updatedAt: number // Unix timestamp (ms) of last write
sessions: Record<string, SessionContinuityRecord>
governance: GovernancePersistenceState
}
SessionContinuityRecord = {
sessionID: string // OpenCode session ID (ses_XXXX)
promptParams: object // Prompt creation parameters
toolProfile?: object // Allowed/denied tools
metadata: {
status: TaskStatus // pending | queued | running | completed | failed | error | cancelled | interrupt
description: string
delegation: DelegationMeta | null
category?: string
constraints: string[]
lifecycle?: SessionLifecycleState // current phase + transition history
pendingNotifications: PendingNotification[] // Queued parent-session notifications
resultCapture?: CapturedResult
compactionCheckpoint?: CompactionCheckpointData
delegationPacket?: DelegationPacket
route?: string
lastToolActivityAt?: number
updatedAt: number
}
}
SessionLifecycleState = {
phase: SessionLifecyclePhase // created | queued | dispatching | running | completed | failed
observation?: { source: string; observedAt: number; detail: string }
error?: string
transitionHistory?: Array<{ from: SessionLifecyclePhase; to: SessionLifecyclePhase; at: number }>
}
PendingNotification = {
sessionID: string
description: string
agent: string
status: "started" | "completed" | "failed" | "cancelled"
error?: string
resultPreview?: string
briefSummary?: string
outputLink?: string
duration?: number
metadata?: {
delegationId: string
terminalState: DelegationStatus
recoveryGuarantee?: "resumable" | "best-effort" | "non-resumable-after-restart"
summaryPreview?: string
}
createdAt: number
delivered: boolean
}

Read contract:

  • Deep-clone-on-read via cloneSessionContinuity() / getSessionContinuity(sessionID) — prevents mutation aliasing
  • Single-record read: getSessionContinuity(sessionID) → SessionContinuityRecord | undefined
  • Bulk read: listSessionContinuity() → SessionContinuityRecord[]
  • Always use the read functions through the continuity.ts module — never read the raw file directly

Write contract (for tools only, not agents):

  • patchSessionContinuity(sessionID, partial) — shallow merge into existing record
  • recordSessionContinuity(record) — full upsert
  • All writes go to .hivemind/state/session-continuity.json
  • Write-before-respond: always persist state changes before returning tool results

Recovery paths:

  • hydrateFromContinuity() — loads all sessions from disk, rehydrates delegation state into in-memory Maps
  • recoverPending() — called on plugin init, replays delegation polling for sessions not yet terminal
  • replayPendingNotificationsForEvent(sessionID, eventType) — delivers queued parent-session notifications on session.created or session.updated events
2. delegations.json — Delegation Records

Format: Array of Delegation objects (persisted by delegation-persistence.ts)

Schema:

typescript
Delegation = {
id: string // UUID delegation ID
parentSessionId: string // Caller session
childSessionId: string // Spawned child session
agent: string // Agent name dispatched
status: DelegationStatus // dispatched | running | completed | error | timeout
createdAt: number // Unix timestamp (ms)
safetyCeilingMs: number // Max duration (default: 30 min)
lastMessageCount: number // For dual-signal completion detection
stablePollCount: number // Consecutive stable polls
lastMessageCountChangeAt: number // Timestamp of last message change
nestingDepth: number // Delegation chain depth (max: 3)
executionMode: "sdk" | "pty" // Dispatch mechanism
workingDirectory: string // Working directory for child
queueKey: string // Concurrency lane key
surface: "agent-delegation" | "command-process"
recoveryGuarantee: "resumable" | "best-effort" | "non-resumable-after-restart"
explicitCancellation: boolean // User explicitly cancelled
completedAt?: number
error?: string
terminalDetail?: string
resultBriefSummary?: string
gracePeriodExpiresAt?: number
}

Read contract:

  • readPersistedDelegations() — reads the full array from disk
  • Always use through the persistence helper — never read the raw file directly
  • File may be empty after pruning (empty array, not missing)

Write contract (tools only):

  • persistDelegations(delegations: Delegation[]) — overwrites the full array
  • Pruning: when delegations exceed MAX_DELEGATIONS_BEFORE_PRUNE (50), oldest completed/error records exceeding DEFAULT_PRUNE_MAX_AGE_MS (30 min) are removed

Recovery paths:

  • On plugin init: recoverPending() scans for non-terminal delegations and resumes polling
  • handleSessionIdle(sessionID) — triggered by session.idle event, transitions to completed
  • handleSessionDeleted(sessionID) — triggered by session.deleted event, transitions to error with cleanup
3. event-tracker/ — Session Event Journals

Format: One JSON + one Markdown file per session (ses_XXXX.json, ses_XXXX.md)

JSON record:

typescript
EventTrackerRecord = {
sessionId: string
events: Array<{
type: string
source: string // Hook source (session, tool, plugin)
timestamp: number // Unix timestamp (ms)
data?: Record<string, unknown>
}>
}

Read contract:

  • createEventTrackerArtifactsFromHook() — writes events to .hivemind/event-tracker/
  • Controlled by shouldTrackEventTrackerEvent(event) — filters relevant event types
  • Sessions are identified by the last 4 hex chars of the session ID (e.g., ses_2252)
  • Best-effort audit projection: failures are silently ignored, never block canonical event handling

File naming: ses_{last4hex}{json|md} — both JSON and Markdown versions are generated for each tracked session.

4. config-workflows.json — Workflow Configuration State

Format: Versioned JSON object tracking batch-config workflow progress

Schema:

typescript
ConfigWorkflowsStore = {
version: number
updatedAt: number
workflows: Record<string, ConfigWorkflow>
}
ConfigWorkflow = {
id: string
type: string // e.g., "batch-config"
currentTurn: number // Current workflow turn (0-indexed)
turns: Record<string, { // Turn number → status
status: "pending" | "complete" | "failed"
output: object | null
completedAt?: number
}>
targetPrimitives: Array<{ // Primitives being configured
type: "agent" | "command" | "skill" | "tool"
name: string
}>
scope: "project" | "user"
mode: string
startedAt: number
updatedAt: number
}

Read contract:

  • readWorkflow(id) — reads a single workflow record
  • advanceTurn(workflow, turnNumber) — marks a turn as complete
  • persistWorkflow(workflow) — writes updated state to disk

Write contract (tools only):

  • Auto-persisted by configure-primitive tool's tool.execute.after hook
  • Best-effort: failures are silently ignored — does not affect the tool call result
5. planning/ — Task Persistence (hm-planning-persistence)

Format: Subdirectories containing task_plan.md, findings.md, and progress.md

Structure:

.hivemind/state/planning/
└── {reset-name}-YYYY-MM-DD/ # Per-reset planning directory
├── task_plan.md # Task breakdown and status
├── findings.md # Research findings and evidence
└── progress.md # Session progress tracking

Read contract:

  • These files follow the hm-planning-persistence template format
  • Read for cross-session context recovery
  • Written by agents using Manus-style file-based planning
6. SESSION-STATE.md — Session State (WAL Protocol)

Format: Markdown with WAL (Write-Ahead Log) protocol

Structure:

markdown
# SESSION-STATE.md — Title
**WAL Protocol: Write BEFORE responding. Survives compaction.**
## Current Task
[Task description]
## Key Context
[Context bullets]
## Pending Actions
-[ ] [Checklist items]
## Recent Decisions
| Decision | Rationale | When |
|----------|-----------|------|

Read contract:

  • WAL protocol: always read BEFORE responding to maintain context
  • Survives context compaction — this is cross-session durable state
  • Write-before-respond: update status before returning results

Agent Access Boundaries

Agent Depth.hivemind/state/ Read.hivemind/state/ WriteNotes
L0 (orchestrator)Full read accessConditional write via toolsMay dispatch sessions, read all state for coordination
L1 (coordinator)Read current session recordsWrite via delegation tools onlydelegate-task, delegation-status tools proxy writes
L2 (specialists)Read-onlyNo direct writeConsume state, don't mutate. Use tools for mutations
L3 (reference)Read-onlyNo direct writeThis skill level — reference only
Human userFull read accessDirect .hivemind/ edit (not recommended)Prefer tool-mediated access

Anti-Patterns

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
51
Repository forks
16
Repository npm downloads, 7 days
9
7-day trend score
27

Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 20 Sep 2026, a month ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/shynlee04/hivemind-plugin/hm-l3-hivemind-state-reference/badge)](https://verified-skill.com/skills/shynlee04/hivemind-plugin/hm-l3-hivemind-state-reference)

Something wrong with this skill or its page? Tell us.