Install
openclaw skills install ai-architecture-harness-enEstablish and use architectural guardrails for AI-assisted coding to prevent architecture collapse, feature regression, and drift across long multi-turn iterations. Use when the user mentions AI coding, Agent coding, architecture collapse, Harness Engineering, design intent, acceptance rules, golden rules, architecture tests, or wants the codebase to be safer for AI Agent modifications.
openclaw skills install ai-architecture-harness-enHelp coding Agents modify large or complex projects without breaking existing architecture, core functionality, or long-term design intent.
When using this Skill, treat the repository as the source of truth, but treat human-maintained design intent as the highest-level guidance. Do not rely on long conversation history for critical context; key rules must be captured in repo docs or executable checks.
Use a four-layer guardrail model:
1. Human design-intent layer
2. Agent-synced architecture and acceptance docs layer
3. Hard automated constraints layer
4. Human review and golden-rules feedback layer
The Agent’s job is not free-form improvisation, but safe execution within clear boundaries and feedback loops.
When creating or improving guardrails for a project, prefer this minimal structure:
AGENTS.md
docs/DESIGN_INTENT.md
docs/ARCHITECTURE.md
docs/ACCEPTANCE_RULES.md
docs/GOLDEN_RULES.md
docs/ARCHITECTURE_DRIFT.md
DESIGN_INTENT.md is maintained by humans. It records project goals, core architectural principles, non-negotiable tradeoffs, and historical design decisions. It is the “constitution”; do not let the Agent overwrite human intent with the current implementation.
ARCHITECTURE.md records the currently confirmed architecture map. It may be periodically synced by the Agent from code and DESIGN_INTENT.md, but accidental drift must not be automatically legitimized.
ACCEPTANCE_RULES.md records how to verify core features, architectural commitments, and non-regression behavior.
GOLDEN_RULES.md records strong rules distilled from real incidents. Each rule should include incident source, forbidden behavior, required behavior, and how to enforce it automatically.
ARCHITECTURE_DRIFT.md records gaps between design intent and current implementation, classified as: aligned with intent, reasonable evolution, technical debt, needs human decision, or violates design.
Before any non-trivial code change:
AGENTS.md if it exists.docs/DESIGN_INTENT.md, docs/ARCHITECTURE.md, docs/ACCEPTANCE_RULES.md, and docs/GOLDEN_RULES.md if they exist.If the project has no guardrail docs yet, create a minimal viable set first; do not invent a huge documentation system in one shot.
Human design intent is the top anchor. When updating DESIGN_INTENT.md:
Recommended format:
## YYYY-MM-DD - [Decision title]
Design intent:
[What the system must preserve or evolve toward.]
Rationale:
[Why this direction matters.]
Impact:
- [Constraints future changes must obey.]
- [What the Agent must not break.]
After a phase of work completes, or before a major task starts, sync architecture docs:
DESIGN_INTENT.md.aligned with intentreasonable evolutiontechnical debtneeds human decisionviolates designARCHITECTURE.md.ARCHITECTURE_DRIFT.md.Do not assume “current code is the correct architecture.” Current code may already have collapsed or drifted.
Turn architectural commitments into executable checks. For each architectural cornerstone:
ARCHITECTURE.md.Example:
Architectural cornerstone:
PlanAgent must maintain multi-turn persistent memory.
Observable pattern:
After 10 consecutive dialogue turns, retrieve, summarize/update, and persist in the memory-management chain must run.
Acceptance test:
Simulate 10 dialogue turns; assert expected MemoryManager methods were called and results entered persistence or context assembly.
Prefer deterministic checks over AI judgment alone:
Type checking > unit tests > integration tests > architecture tests > lint > CI > AI review > prompt reminders
AI review is only a semantic supplement, not a core guardrail.
When building guardrails, prioritize preventing:
If the project has clear layering, encode allowed dependency direction as tests or lint rules.
When existing guardrails fail to stop architecture collapse, feature regression, or drift:
GOLDEN_RULES.md.Recommended format:
## [Rule title]
Incident source:
[What happened and when.]
Forbidden behavior:
[What the Agent must not do again.]
Required behavior:
[Correct architectural behavior.]
Enforcement:
- [Tests, lint, CI checks, or review steps.]
Do not turn GOLDEN_RULES.md into generic advice. Keep it short, high-signal, and grounded in real incidents or high-risk patterns.
After the Agent completes a meaningful change, before the final reply, check:
If any answer indicates risk, either fix it or record it as architectural drift needing human decision.
When the user asks to design guardrails, deliver:
When the user asks to apply guardrails to code, read existing docs and tests first, make small scoped changes, and validate with the project’s strongest automated checks.