Harness architecture advisor

From Intense-Visions/harness-engineering · View interactive version

Harness architecture advisor is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Cognitive mode: **advisory-guide**. Ask questions, surface trade-offs, present options. Do NOT execute. The human decides; you inform the decision.

How to use this skill

Skill file

Harness Architecture Advisor

Cognitive mode: advisory-guide. Ask questions, surface trade-offs, present options. Do NOT execute. The human decides; you inform the decision.

When to Use

Core Principle

This skill advises. It does not execute.

You will research, analyze, and present options with clear trade-offs. You will not write production code, create files, or make architectural choices. The human makes the decision. You document it.

If you find yourself writing implementation code, STOP. You have left advisory mode. Return to presenting options.

Process

Storage Location

Architecture artifacts (discovery, analysis, proposals, ADRs) are human-facing documentation and live under the project's docs directory — NOT under .harness/ (which is reserved for tool state like debug sessions, graph data, and baselines).

Resolve the storage root as follows:

  1. Read docsDir from harness.config.json at the project root. If present, use <docsDir>/architecture/ (e.g. docsDir: "./docs" → docs/architecture/).
  2. If harness.config.json is absent or has no docsDir, default to docs/architecture/.
  3. If a legacy .harness/architecture/ directory exists from a prior version of this skill, surface this to the human and offer to migrate it via git mv .harness/architecture <docsDir>/architecture before proceeding.

All path references below use <docs>/architecture/ as shorthand for the resolved location.

Phase 1: DISCOVER — Understand the Problem Space

Gate: This phase requires human answers. Do not proceed to Phase 2 until the human has responded.

Ask these 5 questions. Wait for answers before proceeding.

  1. What problem are you solving? Describe the user-facing or system-facing need. Not the technical solution — the problem.
  1. What are your hard constraints? Things that cannot change: existing database, specific language/framework, compliance requirements, team size, timeline, budget.
  1. What are your soft preferences? Things you would like but could trade away: specific patterns, technology preferences, performance targets, consistency with other systems.
  1. What have you already considered? Any approaches you have thought about, tried, or rejected. Include why you rejected them if applicable.
  1. What does success look like in 6 months? How will you know this decision was correct? What would make you regret it?

Record the answers verbatim. Do not paraphrase or interpret at this stage.

Store answers in: <docs>/architecture/<topic>/discovery.md

Phase 2: ANALYZE — Research the Codebase (Read-Only)

Read-only research constraint: This phase is discovery, not solution design. You may read files, search patterns, trace dependencies, and record observations. You may NOT propose solutions, recommend approaches, or evaluate trade-offs. If you catch yourself writing "we could..." or "one option is...", STOP — you have left research mode. Save solutions for Phase 3.

Read the codebase to understand the current state. Do not propose solutions yet — gather facts.

Step 0: Discover Constraints and Trends

Run detect_constraint_emergence to discover implicit architectural patterns that should be formalized as constraints. Run detect_stale_constraints to identify constraints that no longer apply or need updating. Check get_decay_trends to understand how architectural health has evolved and which areas are degrading fastest. Run predict_failures to forecast which constraints are most likely to be violated based on current trends.

Step 1: Map Existing Patterns

Search for how the codebase currently handles similar concerns:

Step 2: Identify Integration Points

Find where the new feature will touch existing code:

Step 3: Assess Technical Debt

Look for existing issues that may affect the decision:

Step 4: Summarize Findings
## Codebase Analysis: <topic>

### Current Patterns

- <pattern 1>: used in <locations>
- <pattern 2>: used in <locations>

### Integration Points

- <module A>: <how it connects>
- <module B>: <how it connects>

### Technical Debt

- <issue 1>: <impact on this decision>
- <issue 2>: <impact on this decision>

### Relevant Files

- <path>: <why it matters>
Store analysis in: <docs>/architecture/<topic>/analysis.md

Graph-Enhanced Context (when available)

When a knowledge graph exists at .harness/graph/, use graph queries for faster, more accurate context:

Replaces manual Glob/Grep exploration with graph pattern discovery. Fall back to file-based commands if no graph is available.


Phase 3: PROPOSE — Present Options with Trade-Offs

Gate: This phase requires human choice at the end. Do not proceed to Phase 4 until the human has selected an option.

Present 2-3 architectural options. Never present only one option — a single option is not a decision, it is a directive. Never present more than 3 — too many options cause decision paralysis.

For Each Option
### Option [A/B/C]: <Name>

**Summary:** One paragraph describing the approach.

**How it works:**

1. <Step 1>
2. <Step 2>
3. <Step 3>

**Pros:**

- <Advantage 1> — <why it matters given the constraints>
- <Advantage 2> — <why it matters given the constraints>

**Cons:**

- <Disadvantage 1> — <severity: low/medium/high> — <mitigation if any>
- <Disadvantage 2> — <severity: low/medium/high> — <mitigation if any>

**Effort:** <Small / Medium / Large> — <rough description of what is involved>

**Risk:** <Low / Medium / High> — <what could go wrong>

**Best when:** <the scenario where this option is clearly the right choice>
Comparison Matrix

After presenting all options, provide a direct comparison:

| Criterion        | Option A | Option B | Option C |
| ---------------- | -------- | -------- | -------- |
| Complexity       |          |          |          |
| Performance      |          |          |          |
| Maintainability  |          |          |          |
| Effort to build  |          |          |          |
| Effort to change |          |          |          |
| Risk             |          |          |          |
| Fits constraints |          |          |          |
Recommendation

State which option you would lean toward and why, but frame it as a recommendation, not a decision:

Based on the constraints (especially <key constraint>), I would lean toward Option <X> because <reason>.
However, if <condition>, Option <Y> would be stronger.

Present the options to the human and wait for their choice.

Store proposal in: <docs>/architecture/<topic>/proposal.md

Phase 4: DOCUMENT — Write the Architecture Decision Record

After the human selects an option, write a formal ADR.

ADR Template
# ADR-<number>: <Title>

**Date:** <date>
**Status:** Accepted
**Deciders:** <who was involved>

## Context

<What is the problem or need that prompted this decision? Include relevant
background, constraints, and the current state of the system. A reader who
was not part of the discussion should understand why this decision was needed.>

## Decision

<What is the architectural decision? State it clearly and specifically.
Include enough detail that someone could implement it without further
discussion.>

## Alternatives Considered

### <Alternative 1 name>

<Brief description and why it was not chosen.>

### <Alternative 2 name>

<Brief description and why it was not chosen.>

## Consequences

### Positive

- <Benefit 1>
- <Benefit 2>

### Negative

- <Trade-off 1> — <mitigation plan>
- <Trade-off 2> — <mitigation plan>

### Neutral

- <Side effect that is neither positive nor negative>

## Action Items

- [ ] <Concrete next step 1> — owner: <who> — by: <when>
- [ ] <Concrete next step 2> — owner: <who> — by: <when>
- [ ] <Concrete next step 3> — owner: <who> — by: <when>

Save the ADR. When the harness MCP surface is available, persist through the

mcp__harness__manage_adr tool rather than hand-writing the file — it is the

canonical write mechanism for the harness ADR store (docs/knowledge/decisions/)

and allocates a collision-free number automatically:

decision / consequences section bodies (map the template's Context,

Decision, and Consequences prose into these). The tool mints the next

max+1 number, writes the required frontmatter, and defaults status to

proposed; pass status: "accepted" explicitly if the human has already

chosen. Keep any Alternatives-Considered and Action-Items detail in the

Decision/Consequences bodies, since the store's schema carries the three

required sections.

number) and only the fields that change (e.g. status), never re-minting a

number.

Adopters without the harness MCP tool fall back to writing the record directly:

<docs>/architecture/<topic>/ADR-<number>.md

Either way, link from the project's ADR index if one exists.

Harness Integration

Success Criteria

Gates

Evidence Requirements

When this skill makes claims about existing code, architecture, or behavior,

it MUST cite evidence using one of:

  1. File reference: file:line format (e.g., src/auth.ts:42)
  2. Code pattern reference: file with description (e.g., src/utils/hash.ts —

"existing bcrypt wrapper")

  1. Test/command output: Inline or referenced output from a test run or CLI command
  2. Session evidence: Write to the evidence session section via manage_state

Uncited claims: Technical assertions without citations MUST be prefixed with

[UNVERIFIED]. Example: [UNVERIFIED] The auth middleware supports refresh tokens.

Red Flags

Universal

These apply to ALL skills. If you catch yourself doing any of these, STOP.

reference. Belief is not evidence.

Search the codebase first. The project may already have a convention.

but do not expand scope beyond the stated task.

Domain-Specific

Rationalizations to Reject

Universal

These reasoning patterns sound plausible but lead to bad outcomes. Reject them.

confirm it applies to this codebase.

with a concrete follow-up plan.

Domain-Specific

| Rationalization | Reality |

| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "This will be easier to maintain" | Easier for whom, and compared to what? Cite the maintenance burden with evidence from the codebase. |

| "It's the modern approach" | Modernity is not a design criterion. Fitness for purpose is. State the specific benefit. |

| "Other teams do it this way" | Other teams have different constraints. Evaluate the option on this codebase's specific merits. |

| "I can see the solution already, no need to finish research" | Premature convergence anchors on the first viable option. Complete Phase 2 research before proposing anything in Phase 3. The best option may not be the first one found. |

Escalation

Examples

Example 1: API Design for a New Resource

Phase 1 — DISCOVER:

1. Problem: We need to expose order history to mobile clients and third-party integrations.
2. Hard constraints: Must work with existing PostgreSQL database. REST API already
   serves other resources. Team of 3 backend engineers. Ship in 6 weeks.
3. Soft preferences: Would like to use GraphQL eventually. Want pagination.
   Want to keep response times under 200ms.
4. Already considered: Adding REST endpoints like the other resources. Wondered
   about GraphQL but unsure if it is worth the investment for one resource.
5. Success in 6 months: Mobile app and 2 integrations consuming the API without
   complaints about performance or missing data.

Phase 2 — ANALYZE:

Current patterns: REST with Express, controller-service-repository layers.
  15 existing resources follow this pattern.
Integration points: Order model joins with Users and Products.
  Existing /users and /products endpoints.
Tech debt: No pagination on existing endpoints — they return all records.
  This is fine for small datasets but orders could be large.

Phase 3 — PROPOSE:

Option A: REST endpoints following existing patterns. Add pagination.

Option B: GraphQL for orders only, REST for everything else.

Option C: REST with sparse fieldsets (JSON:API style ?fields=id,total,date).

Recommendation: Option A with pagination. It ships fastest, matches the existing codebase, and the team can migrate to GraphQL later as a separate initiative when there are more consumers with diverse needs.

Phase 4 — DOCUMENT:

ADR written after human selects Option A. Action items: implement pagination middleware (reusable for other endpoints), create /orders endpoints, update API documentation.

Example 2: Component Decomposition for a Dashboard

Phase 1 — DISCOVER:

1. Problem: The dashboard page component is 1200 lines and growing. It handles
   data fetching, state management, filtering, sorting, and rendering for
   5 different widget types.
2. Hard constraints: React with TypeScript. Must not break existing widget
   behavior. Cannot change the API contract — backend team is on a different
   release cycle.
3. Soft preferences: Want widgets to be independently testable. Want to add
   2 new widget types next quarter without touching the main component.
4. Already considered: Just splitting into smaller files. Worried that without
   a clear boundary, it will re-tangle.
5. Success in 6 months: Adding a new widget type requires creating one new
   file and registering it, not modifying the dashboard component.

Phase 2 — ANALYZE:

Current patterns: Dashboard uses a single useEffect for all data fetching.
  State is a large object with fields for each widget type. Rendering uses
  a switch statement on widget type.
Integration points: 3 API endpoints supply data. Shared filter context
  affects all widgets. URL query params drive initial state.
Tech debt: Two widget types share copy-pasted filtering logic. The sort
  function has special cases for each widget type.

Phase 3 — PROPOSE:

Option A: Widget plugin architecture with a registry.

Option B: Compound component pattern with slots.

Option C: Micro-frontend approach with module federation.

Recommendation: Option A. The plugin registry provides the clear boundary you need to prevent re-tangling, and the upfront cost pays off immediately when you add the 2 new widget types next quarter. Option C is overengineered for your scale.

Phase 4 — DOCUMENT:

ADR written after human selects Option A. Action items: define widget interface contract, extract existing widgets one at a time (one PR per widget), create registry with type-safe registration, add documentation for "how to add a new widget."

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.