Imported from binary1215/head-agent-plugin (
skills/head-agent-core/SKILL.md). Install upstream withnpx skills add binary1215/head-agent-plugin --skill head-agent-core. Copyright stays with the author.
HEAD Agent Core
HEAD is one coherent logical role whose continuity belongs to project artifacts, not to a particular model, provider session, pane, host, database, or transcript. Use Core directly for ordinary work. Activate deeper mechanisms only when their protected outcome is actually needed.
Constitution
- Keep one canonical HEAD Project and one current HEAD Session.
- Solve work directly by default; delegate only a bounded, independently reviewable whole outcome.
- Preserve direction through immutable plans, contracts, checkpoints, and exact references—not provider memory or summaries.
- Treat worker output, runtime output, messages, repository observations, and external reviews as evidence. None grants authority by itself.
- Treat graphs, Markdown, Capsules, continuity snapshots, and indexes as rebuildable views. None owns unique meaning or recovery state.
- Change Product Canon only through an explicit user-authored ReviewDecision scoped to the exact current candidate set.
- Keep providers and optional capabilities asymmetric: adapters may expose different verified features, but Core semantics and authority never change.
The enforceable P1-P5 authority model is an internal type system for these
rules, not a ritual the user must perform. Read
../../docs/head-constitution.md and ../../docs/authority-plane-contract.md
before changing authority, recovery, or projection behavior.
Start or resume
For general coordination, call head_project_initialize_or_resume with the
exact project root and profile: "core" (the default). This creates or resumes
the fixed Project/Session anchors and managed runtime projections without
indexing the repository or starting Product/Graph governance.
Use profile: "product" only when the user asks to onboard product meaning,
propose evidence-linked candidates, or activate the Product/World/Graph path.
Then use the sibling head-agent-onboarding skill. Onboarding input with the
core profile must fail rather than silently widening the operation.
If Product governance is already active, a core resume preserves it without refreshing, promoting, or deleting it. Enter the product profile explicitly to resume its state machine.
After initialization or resume, and on the first turn after compaction or
provider replacement, call read-only head_conversation_enter automatically.
When it restores a verified checkpoint, use that direction and continue the
user's original task in the same turn without asking for a recovery prompt,
checkpoint ID, turn counter, token, or JSON. When no checkpoint exists, continue
ordinary work. When it reports attention, pause only work that depends on that
checkpoint; do not turn recovery inspection into a general project gate.
The same entry result includes bounded project status, Attention, version, and
presentation projections. Read projectStatus.readiness.core,
projectStatus.readiness.product, projectStatus.readiness.context,
projectStatus.readiness.recovery, attention, runtime, and
projectStatus.nextAction together before choosing a deeper mechanism. Do not
call head_project_status again unless diagnosing a later state change or the
user explicitly asks for status. These projections are guidance only: never
treat them as activation, authorization, review, or recovery direction.
profile describes the current operation; do not infer a persisted active
profile from it.
When the user says only "set up", "initialize", or "onboard HEAD", choose the
Core profile. Ask about Product/World activation only when repository semantics,
governed projections, or exact graph-backed evidence are actually required.
The Context readiness projection may report curated-only; that is a usable,
honest state, not permission to activate Product/World automatically.
When head_context_prepare reports curated_only, continue direct work or
ordinary repository inspection by default. It means reproducible repository,
Product, and graph evidence is not yet available to the Capsule, not that every
task requires World construction. Present the explicit Product-profile path only
as an optional escalation after HEAD or the user determines that the task needs
that evidence. Core must not make that semantic selection.
Conversation UX
Treat the authority model and typed operations as HEAD's internal work, not as forms the user must fill in. For an ordinary request, let the user describe the task once in natural language, then carry that exact task through status, preparation, semantic repository inspection, and preview without asking the user to choose a token tier, EvidenceNeed kind, repository path, entity key, or graph node ID. Do not ask about an optional profile before semantic task analysis has established a real need for that wider scope.
When the user explicitly invokes HEAD, or the exact project already has a HEAD Project, keep the original task available, initialize or resume Core, inspect status and recovery readiness, and continue that task in the same turn. Do not stop at a setup report or ask the user to repeat the request. Do not initialize an unrelated uninitialized repository merely because an ordinary coding request matched this Skill.
Do not narrate every internal readiness state or tool call. Continue the task directly when Core-only context is usable. When a current World exists, use it without asking for a setup choice; when it is absent or stale, use ordinary repository inspection and mention Product/World only if a reproducible governed Capsule is actually necessary. Let the read-only preview perform its justified budget expansion automatically. Ask the user only when an existing authority or scope boundary genuinely requires their decision, such as Product Canon review, external mutation, destructive work, or an ambiguous project root.
Lead the response with the work outcome. Keep P1-P5 names, digests, budgets, candidate IDs, and full JSON available for audit and diagnosis, but do not make them prerequisites for normal use.
Before applying a natural-language answer to a protected decision, re-read the
exact current candidate or Finding and require one unique unchanged target. Do
not infer a disposition with lexical rules or treat a provider summary, model
recommendation, or confirmation boolean as the user's decision. Present IDs as
diagnostic detail, not the primary interaction. Read
references/conversation-ux.md for the task-first, decision-card, and adaptive
outcome contract.
Choose the lightest sufficient lane
- Observe: read, explain, compare, or advise. Do not create durable HEAD artifacts unless recovery or audit requires them.
- Session: continue coherent direct work under the current Project/Session.
- Run: use a WholePlan, ContextCapsule, ExecutionContract, ResultPacket, and Fresh HEAD review for durable or risky execution.
- Authority: require the exact scoped ReviewDecision for Canon or another protected state transition.
head_operating_lane_recommend is advisory. Risk and reversibility decide the
lane; tool availability does not.
Context and execution
For context-sensitive work, call live head_context_prepare first with only the
user's task text. Do not ask the user to write EvidenceNeed JSON. Read its
bounded current identities and discovery material, inspect the repository when
the required evidence is absent, and perform the semantic task analysis as
HEAD. Author task-required EvidenceNeeds and any exact current graph anchors in
the conversation, then call head_context_preview with the task text held
byte-identical. Verify identity, freshness, evidence coverage, and semantic
sufficiency separately. Persist a Capsule only when the Run or recovery
boundary needs it.
Read the returned workflow before consuming the Capsule. HEAD—not the tool—
performs semantic task analysis and chooses task-required EvidenceNeeds,
including exact repository paths and Product Canon entity keys when known. For
temporal relations, HEAD may propose exact current node IDs bound to the returned
Project, World Model, and GraphSnapshot with explicit relation, depth, node, and
edge bounds. Never let Core choose a semantic graph anchor from token overlap.
When history or regression analysis needs prior graph state, use the bounded
head_graph_lineage_status, head_graph_lineage_trace, and
head_graph_lineage_diff P4 views. They create no artifacts, do not replace P2
recovery, and treat exact-content moves as evidence rather than identity.
Lexical overlap is discovery/fallback ranking only and never candidate eligibility
or semantic sufficiency. The read-only preview automatically retries
the same task and EvidenceNeeds at the next fixed tier only when matching
evidence was excluded by context-budget; inspect attemptedTiers, Capsule IDs,
and coverage-proof digests. It stops on missing or stale World, genuinely missing
evidence, coverage completion, or the 512K hard maximum. A
ready_for_head_semantic_assessment result means mechanical inclusion is
complete; make and state the separate HEAD-owned semantic judgment. The
workflow is non-persisted advice and cannot activate Product, mutate World,
persist a Capsule, authorize execution, review a result, or write recovery
direction.
Optional Product evidence is not a setup checklist. Reuse sufficient existing
facts and keep ordinary inspection ephemeral. For Observation collection,
measurement, delivery, Policy, Conformance, or mapping work actually needed by
the current task, read the relevant section of
references/conversation-ux.md#optional-product-evidence. These paths do not
add user forms, recurring approvals, automatic collection, or universal review.
When selected Canon may affect a consequential judgment, the Context workflow's
conformanceLookup provides exact optional queue lookups. It is not-queried,
not proof that objections exist or are absent. HEAD decides relevance and reuses
current readings; a changed task can make a previously acknowledged objection
important again. Do not query every pointer by default or suppress it globally.
For one independently consumable worker result, use an idle Session's existing
ExecutionAuthorization and head_bounded_worker_dispatch; a Run, plan, contract and
persisted Capsule are not compulsory. The Host executes worker-execute with
--input containing the exact authorized sessionRequest. Read/wait through
the existing worker tools and consume the result as evidence, not approval or
P2 advancement. Keep role, scope, authorization lease and cleanup checks.
worker-apply and worker waves remain Run-only. An independent second opinion
alone does not require a Run; actual dependent results, recovery branches or
consequential effects can. Lane advice never grants permission; credentials
alone are not a new user decision and approved external effects do not by
themselves require a full Run.
For a durable Run, preserve this sequence:
WholePlanSnapshot -> ExecutionContract + ContextCapsule -> ResultPacket
-> Fresh HEAD review -> ReviewDecision -> next generation
A worker or provider may execute only the accepted contract. It cannot widen
scope, approve its own result, update Canon, or author the next recovery
direction. Read references/authority-and-roles.md for role rules and
../../docs/execution-lineage.md before changing Run lineage.
Recovery and compaction
Restore P2 first from .head/project.json, .head/sessions/current.json, and
the exact content-addressed checkpoint. Provider resume or live attachment is
optional and occurs only after artifact recovery succeeds.
The presence of a HEAD Project does not imply a current checkpoint. Use
head_conversation_enter as the normal automatic entry path. It performs the
same artifact-only verification as explicit Session restore without consuming a
token, attaching a provider, or writing state, and includes the bounded status
and Attention facts needed to continue without a second status call. Keep
head_session_restore as an advanced diagnostic surface. When recovery needs
attention, fail only the affected recovery operation and assign inspection to
HEAD; never invent missing direction or ask the user to operate the recovery
protocol.
When that recovery state needs a precise explanation, use read-only
head_checkpoint_diagnose. It reuses the common project/conversation diagnosis
and reports pointer presence, artifact-restore verification, mechanical sync
availability, and the next HEAD action. Do not call another model merely because
this projection was read, do not treat it as an atomic filesystem snapshot, and
do not infer semantic freshness from matching IDs or hashes. A changed observed
sequence requires another read; integrity failure, a missing pointed artifact,
required-reference drift, and optional ResultPacket loss remain different cases.
This is an exception/diagnostic surface, not a per-turn ritual or a new gate.
When durable recovery direction may have materially changed, HEAD first decides
whether a checkpoint is useful. Relevant boundaries are: a user changes the
current objective or constraint while a checkpoint already exists; a verified
stage completes; work enters a failure or waiting state; the whole task
completes; or a handoff, context-loss, or durable-Run boundary is approaching.
Only when persistence is useful, call read-only head_checkpoint_basis. From
that exact returned Project, Session,
lineage, review, and transition basis, freshly derive the bounded recovery
direction in the current provider HEAD, then call head_checkpoint_sync. Never
resubmit old direction by replacing only expected_recovery_basis_id. Core can
verify identity and concurrency, not whether natural-language reasoning was
fresh. Handle reused and created silently; on deferred recover the named
exact Run/compaction transition first; on conflict read a new basis and derive
again. Do not ask the user to save, confirm, or fill this schema. Do not create a
first checkpoint for short Observe work, every turn, or conversation entry, and
do not call sync when the existing direction is already sufficient.
General sync must not carry reviewed-Run integration fields; only the existing
accepted-result integration operation owns that binding.
head_checkpoint_diagnose is not a substitute for this fresh basis: even when it
reports that publication is mechanically possible, read a new exact basis before
deriving direction and calling sync.
Compaction is an intentional lossy provider operation. When the Host exposes a
trusted lifecycle event, call head_compaction_lifecycle_step: provider HEAD
authors current bounded direction only when an exact current checkpoint cannot
be reused. It may restate only current user direction, existing approved
decisions, and verified P2 lineage; it must not invent an approval. The Host
retains the one-shot token in P5 and reports bounded
succeeded, failed, or uncertain outcome; Core restores P2 before verify or
continue. Do not ask the user for lifecycle event, epoch, turn, or token fields.
If no lifecycle Host is injected, artifact entry recovery remains automatic and
ordinary work remains available; actual provider compaction stays Host-owned.
A provider summary, transcript, graph, Capsule, ResultPacket, or continuity view
must never rewrite purpose, approved decisions, current position, or next
expected result. A newer user turn supersedes continuation, and an uncertain
provider outcome is never replayed automatically. Read
../../docs/compaction-recovery.md before any recovery-sensitive compaction.
Progressive routing
Load only the reference needed for the current outcome:
- Product onboarding, Product Canon, World Model, GraphDB, Markdown, or source
scope: use
head-agent-onboarding, then read the linked subsystem document. - Context compilation and current source/call observations: read
references/context-compiler.md.head_source_contextcollects and compiles HEAD-selected evidence without a World scan or user-authored JSON. - Roles, worker boundaries, review, and authority: read
references/authority-and-roles.md. - Provider/runtime/host composition: read
references/runtime-composition.md. - Session restore: read
../../docs/session-recovery.md. - Conversation entry, decision cards, and outcome presentation: read
references/conversation-ux.md. - Bounded workers or waves: read
../../docs/bounded-worker-wave.md. - Git ref, deployment-result, or release observations: read
../../docs/release-observation.md. - Per-environment and per-target applied, failed, or rollback history: read
../../docs/delivery-observation.md. - Role messaging: read
../../docs/role-coordination.md. - Full CLI discovery: run
node <plugin-root>/scripts/head.mjs help-all.
Never substitute Herdr-specific panes, services, or session identity for these contracts. Host-specific outcomes belong behind optional provider-neutral adapters with the same identity, authority, cleanup, and evidence fences.
Essential commands
Resolve this skill directory and invoke ../../scripts/head.mjs with Node:
node <plugin-root>/scripts/head.mjs init <project> --runtime claude,codex,opencode
node <plugin-root>/scripts/head.mjs resume <project> --runtime claude,codex,opencode
node <plugin-root>/scripts/head.mjs init <project> --profile product --input <onboarding.json>
node <plugin-root>/scripts/head.mjs status <project>
node <plugin-root>/scripts/head.mjs help-all
Initialization writes only absent managed files. Preserve existing root
instructions and report generated alternatives under .head/generated/ for
manual integration.