/semctx:semctx-controlfrom semctx
Use semctx through its MCP tools for top-down root-cause diagnosis, repository impact analysis, authored goals and invariants, proof-carrying change contracts, handoffs, bounded target proposals, and fail-closed migration planning. Use for non-trivial code changes, refactors, migrations, architecture reconstruction, semantic trace requests, invariant preservation, generic project demonstrations, or pre-commit verification in a semctx-enabled repository.
Ships in semctx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Use the semctx MCP server as a proof surface, not as a replacement for repository search or runtime tests. This workflow contract is shared by the Codex and Claude Code plugins.
For every MCP call, pass repositoryRoot as the absolute root of the repository being analyzed. The server rejects missing or relative roots, so hosts use the same explicit target contract even when Claude also binds SEMCTX_ROOT. An unexpanded ${CLAUDE_PROJECT_DIR} process env is treated as unset (pin-on-first-request), not as a bound root.
One exception: semctx_control_verify_authorization takes no repositoryRoot and rejects the field if supplied. Its entire input is { request } — a ChangeAuthorizationCapsuleV1 to verify, an externally sourced expectedAuthorityDescriptorDigest, and verifiedAt (the same instant as, or later than, the capsule's evaluatedAt) — because it never reads a target repository; it verifies a sealed capsule offline.
semctx_control_target_propose may create an immutable hypothetical proposal from explicit target content; never invent the target or treat a proposal as accepted.Before substantial edits, locate the highest broken contract by descending the normative ladder: L6 strategy/constraints → L5 product intent → L4 invariants/policies → L3 capabilities → L2 components/boundaries → L1 symbols/tests/schemas/contracts → L0 sealed observed hunks.
Record this frame:
HIGHEST_BROKEN_LEVEL = L?_NAME | UNKNOWN
WHY_NOT_HIGHER = evidence that the next higher level is healthy | UNKNOWN - missing evidence
WHY_NOT_LOWER = why a lower-level patch would only move or mask the symptom | UNKNOWN - missing evidence
PROOF_PLAN = the smallest check that can falsify this diagnosis
Descend only after evidence clears the current level; ascend only from a concrete repository,
runtime, or control-plane signal. This frame is diagnostic and advisory: it does not become
authored repository truth until explicitly bound through the semantic workflow. Missing links,
STALE, and UNSEALED states remain unknowns; never reindex or reseal merely to make them green.
For a diagnosis-only task, this frame and its observed evidence are the result; stages conditioned
on write_task or after_edits stay inactive. PROOF_PLAN is a falsification plan, not a request
to call semctx_control_plan_change or semctx_control_plan. Use the latter only in their declared
write-task or explicit-target-architecture lanes.
The ordered lifecycle below is generated from the strict AgentWorkflowContractV1. Treat its
declared effects and conditions as the host-neutral policy; host-specific shell resolution appears
only in the final CLI ladder.
Machine policy: enforcement is shadow, blocking is disabled, repositories
without Semctx follow no_op, and execution authority is
none.
read_only; condition: always.semctx_semantic_check, semctx_control_resume, semctx_resume, semctx_semantic_inspect, semctx_semantic_slice; effect: read_only; condition: semantic_context_present.semctx_index_health, semctx_control_status; effect: read_only; condition: semantic_context_present.semctx_control_frame_task; effect: read_only; condition: write_task.semctx_control_bind_scope; effect: read_only; condition: write_task.semctx_control_trace; effect: read_only; condition: write_task.semctx_control_authority; effect: read_only; condition: write_task.semctx_control_target_propose; effect: tracked_create_only; condition: migration_task.semctx_control_plan_change, semctx_control_plan; effect: read_only; condition: write_task.semctx_change_open, semctx_change_update; effect: tracked_create_or_update; condition: write_task.user_authorized_repository_write; condition: write_task.semctx_control_reconcile_diff; effect: read_only; condition: after_edits.semctx_verify_change; effect: read_only; condition: after_edits.semctx_change_verify; effect: read_only; condition: after_edits.semctx_control_handoff, semctx_handoff; effect: working_state_write; condition: before_handoff.Completion requires: reconcile_diff → verify_change → change_verify.
The bounded transfer stage is handoff.
If the workspace is not initialized (no .semctx/ / preflight initialized: false),
do not require a global semctx package install. Prefer the plugin MCP tool:
semctx_setup with { repositoryRoot } (preflight only — no writes).
Preflight returns requiresUserAuthorization: true and a next template without
confirm: true — never auto-follow preflight next.arguments as a write.semctx_setup with
{ repositoryRoot, confirm: true } (optional polyglot: true only for a fresh
multi-language config; on an existing non-v2 config this returns kind: "setup_refused").kind === "setup" and verdict === "SETUP_READY".
Domain outcomes are ordinary structured results (isError false per ADR 0012):
setup_refused / verdict: "SETUP_REFUSED" → agent failure; read reason + nextSteps.verdict: "SETUP_NOT_READY" → agent failure; inspect check / indexHealth;
re-check with semctx_index_health.
Do not treat isError false alone as bootstrap success — always read kind/verdict.
SETUP_READY is not coverage-complete: still call semctx_index_health before
negative-evidence or high-risk claims when coverage is only partial.semctx_control_status / semctx_index_health.Do not auto-run setup merely because control status is UNSEALED or STALE when
.semctx/ already exists — that may be a seal/freshness issue; use semctx_index_health
and an explicit re-index policy instead of silent re-setup.
Never auto-setup silently. Never invent confirm: true from a preflight payload alone.
CLI fallbacks (bun "<plugin-root>/dist/semctx.js" setup or global semctx setup) remain
valid when MCP is unavailable.
Before relying on a global semctx shell fallback, call semctx_cli_compatibility with the same
absolute repositoryRoot. Treat compatible: false as an offline advisory: report the canonical
reason and upgradeCommand, continue using MCP, and never install or upgrade automatically. The
public MCP report intentionally omits the local executable path.
Codex and Claude Code expose semctx_control_agent_lifecycle through the same Semctx MCP runtime.
Both hosts are instructed to invoke these checkpoints. Each plugin also ships a shadow lifecycle
hook that automates only the before_completion checkpoint: it observes which
Semctx MCP tools the host actually invoked and reports that one checkpoint when the agent turn ends,
and only when the observed set has changed since its last advisory — a completed cycle never
re-reports over later turns that produced no evidence, and its silence is absence of evidence rather
than a renewed claim. It never blocks, and it grants nothing. Every other checkpoint has no automatic
host hook, so an instruction to invoke it is not proof that a host event ran.
This is a presence-only advisory contract. NO_OP means no stage-presence obligation applies,
RECORDED means every required stage id was caller-recorded, and INCOMPLETE means required
stage ids are missing. Recorded stage outcomes remain unevaluated and admissibility is not evaluated.
Enforcement is shadow, blocking is disabled, and execution authority is none.
Invoke the checkpoints in policy order:
NO_OP. Manual: no automatic host hook.
Implementation stages: inspect_repository → semantic_check → status → frame_task → bind_scope → trace_impact → authority → refine → change_contract.
Migration stages: inspect_repository → semantic_check → status → frame_task → bind_scope → trace_impact → authority → target_propose → refine → change_contract.reconcile_diff → verify_change → change_verify.
Migration stages: reconcile_diff → verify_change → change_verify.handoff.
Migration stages: handoff.After repository edits, fold prior and newly observed touched coordinate ids as
caller_observed_advisory evidence. Accumulation is
stateless_caller_reinjected_unbound: the caller must reinject prior ids, and Semctx binds them to
no task, session, diff, commit, or handoff. Before completion, record the required completion
stages; before compaction or owner transfer, record handoff.
The shadow lifecycle hook keeps that separation: it accumulates canonical stage ids only, in a
session-local git-ignored ledger, never coordinate ids, never source content, and never a prompt,
transcript or tool payload. It does not start the Semctx runtime, so it never asserts
semctx_ready, and its report carries the same shadow enforcement, disabled blocking and
none execution authority as the tool.
PASS, WARN, BLOCK. PASS is a static policy result, not runtime proof. WARN needs attention but is not a failure. BLOCK must be resolved or explicitly disabled by user-owned policy.VERIFIED, PARTIAL, BLOCKED, STALE. PARTIAL must name every missing proof or open unknown. STALE requires re-linking before the model can be trusted.FRESH, DIRTY_KNOWN, STALE, UNSEALED, or TIMEOUT (the budget ran out and nothing was observed; retry with a larger budgetMs). Only the first two admit high-risk control work. Each reason carries an explanation entry with its concrete cause and a remedy command; quote it, and never run a remedy merely to turn the verdict green.valid, invalid, or absent; coverage is complete, partial, or insufficient; freshness retains its own verdict and reasons. Use semctx_index_health before relying on negative evidence, and never let one field replace or upgrade another or the independent control-freshness verdict. Its machine result is the bounded V2 report in structuredContent (the text block is only a short status), or status: "timeout" when it did not finish within budgetMs, which reports nothing as healthy: the summary keeps status, binding, freshness, coverage, outcome counts and detail totals; request one detail section at a time and follow nextCursor with the same section, restarting without a cursor on INDEX_HEALTH_CURSOR_STALE. A detail page that was not requested never means the details are absent.CLI_VERSION_COMPATIBLE confirms exact lockstep; all other reasons are advisory. They never grant authority and never block an MCP-only workflow.READY, BLOCKED. READY means the plan satisfies its admission rules; it is never execution authority.semctx_setup): verdict is SETUP_READY / SETUP_NOT_READY / SETUP_REFUSED (or preflight without a verdict). Agent success requires kind === "setup" and verdict === "SETUP_READY". Domain refuse/not-ready are structured results with isError false (ADR 0012: catalogue errors have no structuredContent; handlers do not author isError). Namespaced SETUP_* values are not Plane C READY/BLOCKED (migration admission, never execution authority).READY plan as authority to edit, cut over, deploy, or delete. Execution requires the user's write scope and normal safety checks.BLOCK, BLOCKED, or STALE.completedRefinementStepId requests a current-state proof-bearing boundary; count only machine-proved proof-bearing steps as complete.descriptiveRefinementStepIds separate from completed progress. Skip only those explicit zero-obligation labels, fail closed on an empty legacy step whose completion-evidence field is absent, and keep unsupported migration obligations UNPROVEN.semctx_control_status and preserve its reasons, nulls, and current/indexed mismatches verbatim.semctx_index_health binding, freshness, coverage, outcome counts, detail totals, and reasons as separate report fields; read workspace diagnostics and candidate outcomes from their opt-in section pages, never infer them from the summary.Report the framed objective and authority sources; index binding, index freshness, analysis
coverage, workspace diagnostics, outcome counts, and their reasons as separate fields; then the
independent control-freshness verdict, seal hash and input mismatches, L0-L6 impact trace, initial
plan verdict, files changed, runtime checks actually run, final Plane A/B/C verdicts, residual
unknowns, and what semctx prevented from being changed unsafely. Mark conditional fields as not run or not applicable; never invent them. A diagnosis-only report stops at the observed
evidence, unknowns, and PROOF_PLAN.
Never use a global CLI's own doctor output to certify plugin parity: that process knows only its
own package version. If the host-specific ladder below provides a plugin-bundled CLI rung, use that
rung with doctor --json before falling back globally. Otherwise report CLI compatibility as
unverified. Then use the selected rung with index-health --json; a missing cliCompatibility
field remains uncertainty, never evidence of compatibility.
Prefer MCP tools when they are connected. For shell fallbacks, resolve the CLI in this order (stop at the first that works):
bun "…/dist/semctx.js" path in
the block below. Claude Code substitutes the plugin root into this skill when the skill is
loaded, so the path you read is already absolute. Never expect CLAUDE_PLUGIN_ROOT to exist
in the shell — where it is set at all, it is exported to hooks and MCP servers, not to your
terminal. Do not try to guess the plugin directory, and do not assume the shell's cwd is the
plugin package root: it is the user's repository.semctx on PATH (bun install -g semctx@latest / bunx semctx@latest) — keep it on the same
version as the plugin (semctx --version should match the marketplace plugin version).${CLAUDE_PLUGIN_ROOT} inside skill body text, so rung 1 above resolves to a dead path there.
Use bun skill://semctx-control/scripts/omp-cli.mjs instead — OMP's bash tool expands and
shell-quotes that skill:// URI to this skill's own absolute scripts/omp-cli.mjs before
running the command; the skill text is never substituted, only the command OMP actually runs.# Plugin CLI (path substituted at skill load)
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" status --json
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" semantic check --json
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" semantic slice --change change.<slug> --format agent
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" control trace repo:<graph-id> --direction lift --to 6 --json
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" control plan change.<slug> --target target-architecture.json --json
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" verify diff --base origin/main
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" change verify change.<slug> --base origin/main
# Control Handoff v2 — manual shadow surface
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" control handoff <input.json> --json
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" control resume-handoff <capsule-hash> --json
# Legacy Plane-B Handoff v1 compatibility
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" semantic handoff
bun "${CLAUDE_PLUGIN_ROOT}/dist/semctx.js" semantic resume
# Global / CI fallback — same subcommands, no path
semctx --version
semctx status --json
semctx control handoff <input.json> --json
semctx control resume-handoff <capsule-hash> --json
# Oh My Pi only — skill:// URI, expanded by OMP's bash tool at run time (not skill-load time)
bun skill://semctx-control/scripts/omp-cli.mjs status --json
bun skill://semctx-control/scripts/omp-cli.mjs verify diff --base origin/main
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub hoklims/semctx --plugin semctx4 skills in this plugin
/index-control-planeGovern code-intelligence routing, freshness, refresh, consumer generations, provider cost, and fallback across Codex and Claude Code. Use this skill whenever a task asks which code index to use, reports slow or stale indexing, touches CCC/CocoIndex, Graphify, Semctx, Serena, LSP or SCIP, changes index hooks or MCP exposure, opens a substantial Git worktree, or needs architecture/impact retrieval. Prefer this control plane even when the user only says the agent is slow, cannot find code, or seems to use the wrong context./semctx-semanticCarry intent, invariants, decisions, evidence and unknowns through a non-trivial change using the semctx semantic layer. Use when starting substantial work: open or select a change contract, pull a bounded semantic slice, then keep the contract honest as you edit — verify impact, compose the change verdict, run the recommended tests, and record proofs/unknowns. Never conclude on a BLOCK./semctx-verifyVerify the semantic blast radius of a code change before finishing. Use after any non-trivial edit and before a commit or push: check impacted invariants/contracts and run the recommended tests. Invoke when the user asks to commit, open a PR, or "make sure this change is safe".