Best for
- When to Use This Skill
- When NOT to Use
- FORBIDDEN INVOCATION PATTERNS
MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/.opencode/skills/system-deep-loop/deep-alignment/SKILL.md
Autonomous standard-authority conformance: audit artifacts by lane; verify-first, known-deviation suppression, read-only default.
Decision brief
Structured conformance-review loop that checks artifacts against a named standard authority's own creation rules, not general code correctness. Each run resolves one or more alignment lanes (a standard authority, an artifact class, and a scope), audits the artifacts in each lane…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/system-deep-loop/deep-alignment"Inspect the Agent Skill "deep-alignment" from https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory/blob/6f0b93906be829894c38e580010885d54199067f/.opencode/skills/system-deep-loop/deep-alignment/SKILL.md at commit 6f0b93906be829894c38e580010885d54199067f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Review the “Phase Detection” section in the pinned source before continuing.
/deep:alignment is this mode's general invocation point; its command workflow owns state, dispatch, and convergence. /deep:command-benchmark is the single specialized alias permitted to load that same workflow with the command-surface lane config and spec folder pre-bound. The b…
Task: reserved for the command executor's iteration dispatch; never used to hand-dispatch the @deep-alignment LEAF agent directly for looping.
Use this skill when: - Checking whether docs, code, configs, or git history in a scope follow a named authority's own creation standards, not general correctness - Auditing multiple authorities in one run (for example sk-doc and sk-git and sk-code conformance together) - Verifyi…
Use this skill when: - Checking whether docs, code, configs, or git history in a scope follow a named authority's own creation standards, not general correctness - Auditing multiple authorities in one run (for example sk-doc and sk-git and sk-code conformance together) - Verifyi…
Permission review
The documentation asks the agent to run terminal commands or scripts.
Invoke cli-opencode / cli-claude-code directly in a loop to simulate iterationsEvidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 96/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 32 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Structured conformance-review loop that checks artifacts against a named standard authority's own creation rules, not general code correctness. Each run resolves one or more alignment lanes (a standard authority, an artifact class, and a scope), audits the artifacts in each lane against that authority's own templates and standards, and reports findings that have been re-verified against live ground truth before being asserted.
Use this skill when:
deep-review)parent-skill-check.cjs)Boundary: deep-alignment is not parent-skill-check.cjs -- that script checks hub structure (folders, registries, routing wiring), not artifact content. deep-alignment is not deep-review -- that mode audits general code and doc correctness across arbitrary dimensions. deep-alignment audits artifact content conformance against one specific, named authority's own templates and creation standards.
The general entry point for this skill is /deep:alignment. The specialized /deep:command-benchmark launcher may load the owned alignment workflow directly when it pre-binds the stable command-surface lane config and the executing spec folder. That launcher is an alignment alias, not another workflow mode; it must reuse this workflow without nesting the general command or copying its loop.
NEVER:
@deep-alignment LEAF agent via the Task tool for iteration loops (the agent is LEAF, a single iteration, and MUST be driven by the command's workflow)alignment/ subdirectoryALWAYS:
/deep:alignment :auto or /deep:alignment :confirm, supplying [target] [authority] and flags such as --lane-config <file.json> and --max-iterations=N (the full flag set is /deep:alignment's own argument-hint, not duplicated here)/deep:alignment as the general operator entry pointdeep alignment, alignment lane, conformance review, standard authority check, known-deviation suppression, verify-first, structured scoping, artifact conformance
deep-alignment is a nested mode-packet dispatched by the system-deep-loop hub, not a standalone skill; its own references/ and assets/ are private to this packet and are what this section routes across. references/adapters/ holds each registered adapter's spec and known-deviation list; the remaining references/*.md hold the state-agnostic lane-resolution and state-machine protocol docs; assets/ holds the runtime config template.
| Level | When to Load | Resources |
|---|---|---|
| ALWAYS | Every skill invocation | references/scoping-protocol.md |
| CONDITIONAL | If intent/state signals match | Lane config schema, discover contract, state-machine wiring, the active lane's selected adapter + known-deviation pair |
| ON_DEMAND | Only on explicit request | Adapter specs outside the active lane, assets/deep-alignment-config-template.json |
discover_markdown_resources() recursively inventories references/ and assets/.load_if_available() guards markdown paths, checks inventory, and uses seen.get_routing_key() derives the active state from dispatch context; get_adapter_key() prefers the lane's selected adapter and falls back to its authority.UNKNOWN_FALLBACK returns lane/state disambiguation and an unresolved state returns a "no alignment resources" notice.from pathlib import Path
SKILL_ROOT = Path(__file__).resolve().parent
RESOURCE_BASES = (SKILL_ROOT / "references", SKILL_ROOT / "assets")
DEFAULT_RESOURCE = "references/scoping-protocol.md"
INTENT_SIGNALS = {
"ALIGNMENT_SCOPE": {"weight": 4, "keywords": ["alignment lane", "scoping question", "lane-config", "artifact-class", ":auto", ":confirm"]},
"ALIGNMENT_DISCOVER": {"weight": 4, "keywords": ["discover contract", "adapter discover", "artifact corpus", "coverage graph seed"]},
"ALIGNMENT_CHECK": {"weight": 4, "keywords": ["standard source", "known deviation", "verify-first", "conformance check", "P0", "P1", "P2"]},
"ALIGNMENT_CONVERGE": {"weight": 3, "keywords": ["alignment convergence", "coverage threshold", "stability window", "converged"]},
"ALIGNMENT_REPORT": {"weight": 3, "keywords": ["alignment report", "findings registry", "per-lane verdict", "overall verdict"]},
}
NOISY_SYNONYMS = {
"ALIGNMENT_SCOPE": {"three-axis question": 1.6, "authority scope tree": 1.5, "headless conformance sweep": 1.4},
"ALIGNMENT_DISCOVER": {"seed FILE nodes": 1.5, "adapter contract": 1.4, "corpus partitioning": 1.4},
"ALIGNMENT_CHECK": {"re-probe finding": 1.5, "reasoning-agent dispatch": 1.4, "suppress known deviation": 1.4},
"ALIGNMENT_CONVERGE": {"dry-run stability": 1.5, "coverage-and-stability": 1.5, "max iterations": 1.3},
"ALIGNMENT_REPORT": {"worst verdict rollup": 1.5, "one report per lane": 1.4},
}
# RESOURCE_MAP: state-scoped protocol references plus the config asset.
RESOURCE_MAP = {
"ALIGNMENT_SCOPE": ["references/scoping-protocol.md", "references/lane-config-schema.md"],
"ALIGNMENT_DISCOVER": ["references/discover-contract.md"],
"ALIGNMENT_CHECK": ["references/state-machine-wiring.md"],
"ALIGNMENT_CONVERGE": ["references/state-machine-wiring.md"],
"ALIGNMENT_REPORT": ["references/state-machine-wiring.md"],
}
# ADAPTER_RESOURCE_MAP: adapter + known-deviation prompt pack, keyed by the
# active lane's selected adapter. Default adapters keep their authority name.
ADAPTER_RESOURCE_MAP = {
"sk-doc": ["references/adapters/sk-doc-adapter.md", "references/adapters/sk-doc-known-deviations.md"],
"sk-doc-command": ["references/adapters/sk-doc-command-adapter.md", "references/adapters/sk-doc-command-known-deviations.md"],
"sk-git": ["references/adapters/sk-git-adapter.md", "references/adapters/sk-git-known-deviations.md"],
"sk-code": ["references/adapters/sk-code-adapter.md", "references/adapters/sk-code-known-deviations.md"],
}
PHASE_RESOURCE_MAP = {
"scope": ["references/scoping-protocol.md", "references/lane-config-schema.md"],
"discover": ["references/discover-contract.md"],
"iterate": ["references/state-machine-wiring.md"],
"converge": ["references/state-machine-wiring.md"],
"report": ["references/state-machine-wiring.md"],
}
UNKNOWN_FALLBACK_CHECKLIST = [
"Confirm the resolved alignment lane (authority x artifact-class x scope)",
"Confirm the current state (SCOPE/DISCOVER/ITERATE/CONVERGE/REPORT)",
"Provide one concrete artifact path, finding, or expected verdict",
"Confirm the verification command set before completion",
]
def _guard_in_skill(relative_path: str) -> str:
resolved = (SKILL_ROOT / relative_path).resolve()
resolved.relative_to(SKILL_ROOT)
if resolved.suffix.lower() != ".md":
raise ValueError(f"Only markdown resources are routable: {relative_path}")
return resolved.relative_to(SKILL_ROOT).as_posix()
def discover_markdown_resources() -> set[str]:
docs = []
for base in RESOURCE_BASES:
if base.exists():
docs.extend(path for path in base.rglob("*.md") if path.is_file())
return {doc.relative_to(SKILL_ROOT).as_posix() for doc in docs}
def get_routing_key(dispatch_context) -> str:
state = str(getattr(dispatch_context, "state", "")).strip().lower()
if state:
return state
text = str(getattr(dispatch_context, "text", "")).lower()
if "converge" in text or "stability" in text:
return "converge"
if "report" in text or "verdict" in text:
return "report"
if "check" in text or "finding" in text:
return "iterate"
if "discover" in text or "corpus" in text:
return "discover"
return "scope"
def get_authority_key(dispatch_context) -> str:
authority = str(getattr(dispatch_context, "authority", "")).strip().lower()
return authority if authority in {"sk-doc", "sk-git", "sk-code"} else ""
def get_adapter_key(dispatch_context) -> str:
adapter = str(getattr(dispatch_context, "adapter", "")).strip().lower()
authority = get_authority_key(dispatch_context)
if adapter:
return adapter if adapter in ADAPTER_RESOURCE_MAP else ""
return authority if authority in ADAPTER_RESOURCE_MAP else ""
def route_alignment_resources(task, dispatch_context):
inventory = discover_markdown_resources()
routing_key = get_routing_key(dispatch_context)
authority_key = get_authority_key(dispatch_context)
adapter_key = get_adapter_key(dispatch_context)
scores = score_intents(task, INTENT_SIGNALS, NOISY_SYNONYMS)
intents = select_intents(scores, ambiguity_delta=1.0)
loaded = []
seen = set()
def load_if_available(relative_path: str) -> None:
guarded = _guard_in_skill(relative_path)
if guarded in inventory and guarded not in seen:
load(guarded)
loaded.append(guarded)
seen.add(guarded)
load_if_available(DEFAULT_RESOURCE)
if max(scores.values() or [0]) < 0.5:
return {
"routing_key": routing_key,
"load_level": "UNKNOWN_FALLBACK",
"needs_disambiguation": True,
"disambiguation_checklist": UNKNOWN_FALLBACK_CHECKLIST,
"resources": loaded,
}
phase_resources = PHASE_RESOURCE_MAP.get(routing_key, [])
if routing_key == "unknown" or not phase_resources:
return {
"routing_key": routing_key,
"notice": f"No alignment resources found for routing key '{routing_key}'",
"resources": loaded,
}
for intent in intents:
for relative_path in RESOURCE_MAP.get(intent, []):
load_if_available(relative_path)
for relative_path in phase_resources:
load_if_available(relative_path)
for relative_path in ADAPTER_RESOURCE_MAP.get(adapter_key, []):
load_if_available(relative_path)
return {
"routing_key": routing_key,
"authority_key": authority_key or "unspecified",
"adapter_key": adapter_key or "unspecified",
"intents": intents,
"resources": loaded,
}
| State | Signal | Resources to Load |
|---|---|---|
| SCOPE | No deep-alignment-config.json yet, or lane-resolution/--lane-config keywords | scoping-protocol.md, lane-config-schema.md |
| DISCOVER | Config frozen, corpus not yet built | discover-contract.md, the active lane's selected adapter spec |
| ITERATE | Corpus exists, deep-alignment-state.jsonl advancing | the active lane's adapter + known-deviations pair |
| CONVERGE | check-convergence.cjs dispatch context | state-machine-wiring.md (convergence formula) |
| REPORT | Convergence returned CONVERGED, CONTINUE, STOP_MAX_ITERATIONS, NOTHING_TO_CONVERGE, DISCOVERY_INCOMPLETE, or INTEGRITY_FAILURE | state-machine-wiring.md (reducer wiring) |
Each run resolves to one or more alignment lanes, one lane per (standard authority x artifact class x scope) combination the operator names, either through an interactive three-axis question or a non-interactive lane-config file for headless invocation. A per-authority adapter separates "find the artifacts" from "find the standard" from "check the artifact against the standard," so the loop itself never branches on which authority it is running -- new authorities register by implementing the same three methods, not by changing the loop. The loop reuses the same convergence engine other iterative modes in this hub already run on rather than forking a parallel one.
INIT resolves the bound spec folder and loop configuration. SCOPE resolves the run's alignment lanes. DISCOVER finds the artifacts each lane covers. ITERATE checks artifacts against their lane's standard, slice by slice, re-verifying every finding before it is recorded. CONVERGE evaluates coverage and stability against the same thresholds this hub's other convergence-driven modes use. REPORT emits one alignment report per lane. An optional REMEDIATE state follows only when explicitly requested and approved -- it never runs as part of the default, read-only loop.
Four invariants, enforced by the engine itself and not left to individual adapters to opt into:
parent-skill-check.cjs or deep-review instead.REMEDIATE; never treat a report review as implicit approval.deep-alignment-state.jsonl or a delta file is corrupted -- cannot reconstruct iteration history; pause and report rather than guessing at prior findings.check-convergence.cjs returns STOP_MAX_ITERATIONS with lanes still uncovered or unstable -- the run did not converge; report which lanes are unresolved rather than presenting a partial result as a clean pass.loop-lock.cjs acquire fails -- another alignment run holds the lock on this spec folder; do not force-acquire or bypass the lock.FAIL -- a confirmed P0 finding remains; human sign-off is required before treating the audited artifact as shipped-to-standard.--lane-config JSON shape, authority/artifact-class validity, and the error contractdiscover(scope) -> artifacts half of the adapter contractalignment/ file layout, and the convergence formulastandardSource/discover/check specificationsSMART ROUTING (Section 2) as the single routing authority.A run is complete when:
CONVERGED (coverage AND stability), or a documented CONTINUE, STOP_MAX_ITERATIONS, NOTHING_TO_CONVERGE, DISCOVERY_INCOMPLETE, or INTEGRITY_FAILURE outcomealignment-report.md carries one section per lane plus an overall worst-verdict rollupdeep-alignment-findings-registry.json and all canonical state files parse cleanlycoverageThreshold: 1.0)newFindingsRatio === 0 (stabilityWindow: 2)Validation passes when:
node .opencode/skills/system-deep-loop/deep-alignment/scripts/tests/state-machine-wiring.test.cjs passesnode .opencode/skills/system-deep-loop/runtime/scripts/reduce-alignment-state.cjs <spec-folder> returns a JSON summary with registryPath, reportPath, overallVerdict, laneCount, findingsBySeverity, and corruptionCountpython3 .opencode/skills/sk-doc/sk-create-skill/scripts/package_skill.py .opencode/skills/system-deep-loop/deep-alignment --check prints Result: PASSThis skill operates within the behavioral framework defined in the active runtime's root doc (CLAUDE.md or AGENTS.md). Skill routing follows this hub's own advisor wiring; file modifications during a run require the same spec-folder discipline as any other mutation.
/deep:alignment is this mode's general invocation point; its command workflow owns state, dispatch, and convergence. /deep:command-benchmark is the single specialized alias permitted to load that same workflow with the command-surface lane config and spec folder pre-bound. The bound spec folder's alignment/ subdirectory is the only writable state surface outside a gated REMEDIATE pass.
Task: reserved for the command executor's iteration dispatch; never used to hand-dispatch the @deep-alignment LEAF agent directly for looping.
Bash: runs the state-machine scripts (scoping.cjs, check-convergence.cjs, partition-corpus.cjs, each adapter's CLI) and the gated remediate-hook.cjs; never a custom ad-hoc dispatcher.
Grep/Glob/Read: used by adapters and the loop to discover artifacts and re-verify findings against live ground truth.
Required: references/scoping-protocol.md and references/lane-config-schema.md for lane resolution; references/discover-contract.md and the active lane's selected adapter spec for discovery and checking; references/state-machine-wiring.md for convergence and reducer wiring.
Optional: the remaining adapter and known-deviation docs, loaded only when a lane selects that adapter.
The router discovers reference and asset docs dynamically under references/ and assets/. Start with references/scoping-protocol.md, references/lane-config-schema.md, references/discover-contract.md, and references/state-machine-wiring.md, then load the active lane's selected adapter and known-deviation pair, and assets/deep-alignment-config-template.json when the config shape is needed.
Scripts: scripts/scoping.cjs, scripts/check-convergence.cjs, scripts/partition-corpus.cjs, scripts/remediate-hook.cjs, and scripts/adapters/<authority>.cjs.
Related skills: deep-review for general-correctness iterative review sharing this hub's convergence engine, parent-skill-check.cjs for the hub structural checks this mode does not duplicate, and system-spec-kit for command-owned state and continuity saves.
Frequently asked questions
Structured conformance-review loop that checks artifacts against a named standard authority's own creation rules, not general code correctness. Each run resolves one or more alignment lanes (a standard authority, an artifact class, and a scope), audits the artifacts in each lane…
The source record exposes this install command: npx skills add https://github.com/MichelKerkmeester/opencode--skilled-agent-loops-with-spec-kit-memory --skill ".opencode/skills/system-deep-loop/deep-alignment". Inspect the command and pinned source before running it.
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.
Alternatives
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
wanshuiyin/Auto-claude-code-research-in-sleep
Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.
prowler-cloud/prowler
PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing index usage statistics, reindexing, dropping indexes, or working with partitioned table indexes. Also trigger when discussing index strategies, partial indexes, or index maintenance