AGENT SKILL

deepen-architecture

Run the iterative architecture deepening loop (analyze, assess, recommend, plan, execute, verify) to eliminate shallow modules and improve seams. Do not use for speculative wrappers or trivial utility creation.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
deepen-architecture
description
Run the iterative architecture deepening loop (analyze, assess, recommend, plan, execute, verify) to eliminate shallow modules and improve seams. Do not use for speculative wrappers or trivial utility creation.

02 资源文件 2

03 SKILL.md 正文

Architecture Deepening Loop

The architecture deepening loop is the continuous cadence that transforms shallow, leaky modules into deep, high-leverage abstractions with clean public seams.

Every cycle follows a strict six-stage progression:

[1. Analyze] → [2. Assess] → [3. Recommend (HTML)] → [4. Plan] → [5. Execute & Verify] → [6. Record]

See CARD.md for the skill summary card, cheatsheet, and stage-by-stage completion criteria. Consult /codebase-design for the shared vocabulary of modules, interfaces, depth, seams, leverage, and locality.


1. Analyze (The Seam Audit)

Inspect the codebase to identify architectural friction points:

  • Shallow modules — interfaces that expose internal implementation complexity rather than hiding it.
  • Leaky abstractions — callers doing ad-hoc filesystem scans, manual dispatch loops, or duplicate instantiation.
  • Fragmented seams — multiple subsystems implementing identical responsibilities independently.
  • Silent mutations — state or lifecycle transitions occurring outside the audit/telemetry stream.

Completion criterion: 2 to 4 concrete friction sites identified with specific file paths, line numbers, and callers.

1.1 The Typed Seam Elevation Invariant

When auditing seams during the Analyze stage:

  • Never tolerate duck-typed string lookups (e.g. ServiceKey[Any]("...") or hasattr(...)) in agent orchestration loops.
  • Consolidate multi-pass chains into an authoritative, typed ServiceKey[T] interface that hides internal execution stages behind a single high-leverage method call.

2. Assess (The Leverage & Locality Lens)

Evaluate each candidate across three core architectural levers:

  • Locality — Does state and its mutation logic live together in one authoritative place?
  • Leverage — Does the interface provide substantial capability with minimal surface area (high ratio of hidden complexity to interface surface)?
  • Testability — Can the behavior be asserted purely through public seams without reaching into internals or mocking collaborators?

Classify each candidate by recommendation strength:

  • Strong — Clear leverage win, resolves active friction, high locality improvement.
  • Worth exploring — Valuable architectural deepening with minor structural tradeoffs.
  • Speculative — High conceptual elegance but adds abstraction overhead without immediate caller pressure.

Completion criterion: Each candidate scored with concrete before/after architectural descriptions.


3. Recommend (The Visual Brief)

Synthesize findings into an interactive, self-contained HTML review report:

  1. Location: Write to the OS temporary directory (%TEMP%\architecture-review-<timestamp>.html on Windows, /tmp/architecture-review-<timestamp>.html on Unix).
  2. Presentation:
    • Use Tailwind CSS and Mermaid.js via CDN for rich visual styling and dark mode.
    • Include before/after Mermaid diagrams illustrating the shallow vs. deepened topology.
    • Display candidate cards with recommendation badges (Strong, Worth exploring, Speculative).
    • End with an explicit Top Recommendation section stating where to start and why.
  3. Communication: Surface the absolute file path to the user with clickable links.

Completion criterion: HTML report written to %TEMP% and path delivered to the user.


4. Plan (The Checkpoint Artifact)

Formulate an actionable, structured implementation plan:

  1. Write or update implementation_plan.md artifact in the brain directory.
  2. Group proposed edits by subsystem layer (core interfaces first, adapters second).
  3. Explicitly document backward compatibility and regression risks.
  4. Set RequestFeedback: true in artifact metadata to pause execution for user approval.

Completion criterion: User explicitly reviews and approves the implementation plan.


5. Execute & Verify (Zero-Regression Seam Refactor)

Once approved, execute the refactoring in minimal, contiguous edits:

  1. Implement the deep base abstraction and authoritative factory/catalog seam first.
  2. Refactor existing callers and adapters to delegate to the new seam.
  3. Eliminate duplicate legacy methods and ad-hoc traversal loops.
  4. Execute the automated test suite (pytest -v) to achieve 100% pass rate across all unit and integration tests.

Completion criterion: Full test suite passes green with zero regressions and no broken public contracts.


6. Record (The Walkthrough Artifact)

Document the completed architectural improvements:

  1. Update walkthrough.md with:
    • Summary of deepened seams and consolidated components.
    • Clickable links to all modified files and symbols.
    • Verification test metrics (test counts, execution duration, pass rate).
  2. Present a concise markdown overview to the user and await the next iteration trigger.

Completion criterion: walkthrough.md updated and presented cleanly.


Anti-Patterns

  • Speculative Abstraction — Creating deep wrappers around simple utilities that have only one trivial caller.
  • Interface Churn — Breaking public contracts or CLI flags when deepening internal seams; always preserve public backward compatibility unless deprecation was explicitly planned.
  • Skipping Visual Verification — Presenting raw text diffs instead of the temp HTML visual brief and Mermaid diagrams.
  • Proceeding Without Plan Approval — Executing code refactors before the user reviews and signs off on implementation_plan.md.

04 同仓库更多 Skills

SpectreDeath
SpectreDeath/Brain-Harness

ui-behavior-primitive-architect

Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA/SSR/RTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.

★ 0
SpectreDeath
SpectreDeath/Brain-Harness

trustgraph-ontology-governor

Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.

★ 0
SpectreDeath
SpectreDeath/Brain-Harness

shim-harness-governor

Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.

★ 0
SpectreDeath
SpectreDeath/Brain-Harness

graphiti-zep-memory-governor

Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash/LSH entity dedup, RRF/MMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.

★ 0
SpectreDeath
SpectreDeath/Brain-Harness

agora-mcp-workbench-architect

Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway/dispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.

★ 0
SpectreDeath
SpectreDeath/Brain-Harness

skill-eval-assurance-runner

Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.

★ 0