/agent-kernel:architecture-guardianfrom Agent Kernel
Prevents architecture drift during AI-assisted code changes by enforcing bounded discovery, reuse-first search, dependency rules, and change contracts. Activate before non-trivial features, refactors, cross-module fixes, new services, or schema changes.
Ships in Agent Kernel. 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.
Architecture Guardian is Agent Kernel's local conformance workflow for AI-assisted code changes. It separates existing debt from new regressions, requires reuse evidence before parallel abstractions, and keeps implementation inside a reviewed task boundary.
Do not require a full contract for a trivial typo or isolated documentation correction unless project policy explicitly requires it.
Read AGENTS.md, relevant agent instructions, and .agent-kernel/architecture/policy.json when present. Do not infer policy from a roadmap or an old report.
agent-kernel architecture doctor . --json
agent-kernel architecture policy validate . --json
If policy or stored architecture state is malformed, stop and repair the state before enforcing it.
agent-kernel architecture discover . --json
Use the discovered map to identify source roots, layers, internal edges, external packages, cycles, and importer evidence. Discovery reads bounded source files; it does not execute repository code.
Before creating a capability:
agent-kernel architecture reuse "<business capability>" . --json
Review symbols and files with adjacent responsibility. Do not create a parallel source of truth just because an existing abstraction has a different name.
For non-trivial work:
agent-kernel architecture contract init . \
--task "<reviewed task>" \
--owner "<domain or team>" \
--allow "src/area/**,test/area/**" \
--expect "src/area/file.ts,test/area/file.test.ts" \
--dependencies "<new packages, if any>" \
--tests "<observable behavior>"
agent-kernel architecture contract validate . --json
The contract should be narrow enough to detect drift and broad enough to complete the reviewed task. Do not silently add unrelated directories.
Keep business rules in the reviewed domain layer. Use public interfaces rather than reaching into infrastructure internals. Preserve one source of truth for each rule.
A Claude PreToolUse hook can enforce Write, Edit, and MultiEdit scope. Review mode reports; strict mode denies.
agent-kernel architecture check . --json
For an intentionally enforced project:
agent-kernel architecture check . --strict --json
Classify every finding:
Do not hide a critical violation behind an aggregate score.
Close the contract after the task is complete:
agent-kernel architecture contract close . --json
Update a baseline only after reviewing existing findings. A baseline is not an ignore file.
Create a baseline only after discovery and review:
agent-kernel architecture baseline . --json
agent-kernel architecture diff . --json
A baseline records reviewed existing findings and package/import evidence. New blockers remain distinguishable from old debt.
agent-kernel architecture exception add . \
--rule no-cycles \
--files "src/legacy/**" \
--reason "Migration is split across two reviewed releases" \
--owner platform \
--expires "2026-12-31T00:00:00.000Z"
agent-kernel architecture exception list . --json
agent-kernel architecture exception revoke . <exception-id>
Exceptions must be narrow, owned, and expiring. Prefer fixing the architecture or detector over creating long-lived exemptions.
Review mode is the adoption default. It reports candidate blockers without preventing work.
Strict mode returns a nonzero exit for new blocking violations. Enable it only after policy, baseline, contract, and exceptions are trustworthy.
The hook override is explicit:
AGENT_KERNEL_ARCHITECTURE_MODE=review agent-kernel architecture check . --json
AGENT_KERNEL_ARCHITECTURE_MODE=strict agent-kernel architecture check . --json
When an architecture check exposes a repeated agent mistake:
agent-kernel failure capture \
--from <agent> \
--type architecture-failure \
--command "agent-kernel architecture check . --strict --json" \
--exit-code 2 \
--text "<redacted finding>" \
--root-cause "<supported cause>" \
--fix "<verified correction>"
Promote a reusable lesson through the normal proposal and approval flow. Do not mutate policy automatically from one finding.
A complete Architecture Guardian response should state:
Read only the focused reference needed for the task:
references/workflow.mdreferences/policy-model.mdreferences/change-contracts.mdreferences/baselines.mdreferences/exceptions.mdreferences/reuse-first.mdreferences/hooks.mdreferences/false-positive-control.mdreferences/language-support.mdreferences/ci-and-gates.mdreferences/evaluation.mdreferences/threat-model.mdCanonical docs:
references/baselines.md (opens in a new tab)references/change-contracts.md (opens in a new tab)references/ci-and-gates.md (opens in a new tab)references/evaluation.md (opens in a new tab)references/exceptions.md (opens in a new tab)references/false-positive-control.md (opens in a new tab)references/hooks.md (opens in a new tab)references/language-support.md (opens in a new tab)references/policy-model.md (opens in a new tab)references/reuse-first.md (opens in a new tab)references/threat-model.md (opens in a new tab)references/workflow.md (opens in a new tab)schemas/architecture-baseline.schema.json (opens in a new tab)schemas/architecture-exceptions.schema.json (opens in a new tab)schemas/architecture-map.schema.json (opens in a new tab)schemas/architecture-policy.schema.json (opens in a new tab)schemas/change-contract.schema.json (opens in a new tab)schemas/conformance-report.schema.json (opens in a new tab)templates/change-contract.json (opens in a new tab)templates/claude-hooks.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (immamdouhaboammar/agent-kernel) — no native marketplace selected
npx claudepluginhub p/immamdouhaboammar-agent-kernel4 skills in this plugin
/agent-kernelLocal-first governance, memory, runtime evidence, project isolation, architecture conformance,
and release safety for AI coding agents. Use Agent Kernel when a user wants Claude Code,
Codex, Cursor, OpenCode, Antigravity, Gemini CLI, or AGENTS.md-compatible agents to share
persistent rules, reviewed workflows, Failure Lessons, episodes, bounded runtime context,
project connection manifests, provider approvals, generated guidance, MCP tools, hooks,
command guards, or architecture contracts. Strong triggers include: remember this rule,
make every coding agent follow this workflow, capture this recurring failure, search previous
debugging evidence, prevent architecture drift, search before creating a service, connect this
repository safely, configure local MCP, secure the runtime daemon, inspect project provider
boundaries, or prepare and verify an Agent Kernel release.
/agent-kernel-evolveUniversal Self-Evolve & Self-Learning guide for AI agents. Enables any agent (Claude, Antigravity, Cursor, Codex, Gemini, OpenCode) to automatically capture learning moments, synthesize repeatable Playbooks, and evolve workflows./agent-kernel-opsOperational guide for agents working with Agent Kernel v1.20.0+ — environment vault, memory proposals, policies, installation, and diagnostics