# Vivechak (vck) v0.1.0 — Complete Release Documentation > Canonical full-text manual compiled from https://vivechak.bhaskarjha.dev/docs/* > MIT License · Local-first Go MCP server & CLI · https://github.com/bhaskarjha-dev/vivechak --- # Quickstart — Vivechak in 5 Minutes > Install the ~9 MB static Go binary (vck), auto-configure your MCP editor, and gate your first architectural decision in Git. ## Overview Transform technical decisions from gut-feel and cached LLM training data into structured, evidence-grounded research. Vivechak runs at three scope levels depending on what you are deciding: | Scope | Entry Generator | Output Artifact | Typical Investment | | --- | --- | --- | --- | | **Full Project** | [`GENERATOR-PROJECT.md`](../GENERATOR-PROJECT.md) | Founding Architecture Document (FAD) | 4–30 sessions (DAG-ordered) | | **Single Decision** | [`GENERATOR-DECISION.md`](../GENERATOR-DECISION.md) | Architecture Decision Record (ADR) | 1–3 sessions | | **Bounded Comparison** | [`GENERATOR-COMPARISON.md`](../GENERATOR-COMPARISON.md) | Weighted Evaluation (WEP) Matrix | 1 session | Below are the two ways to use Vivechak: **Path A** via automated MCP server (recommended), or **Path B** manually in your browser. ## Running Example: Choosing a Database for a Multi-Tenant SaaS Throughout this quickstart, we use a concrete scenario: > **Note:** *Building a multi-tenant B2B analytics platform ingesting 20M events/day. We need to decide whether to use PostgreSQL with TimescaleDB, ClickHouse, or DynamoDB + Athena, taking into account tenant isolation, write throughput, and query latency.* ## Path A: MCP Server (Recommended) Give your AI coding agent (Cursor, VS Code, Claude Desktop, Antigravity, etc.) direct access to Vivechak's 9 consolidated orchestration tools. ### 1. Install & Run **Instant / Ephemeral Runners (Zero Pre-Installation Required):** ```markdown # Node.js / npx (macOS, Linux, Windows) npx -y vivechak serve # Python / uvx (macOS, Linux, Windows) uvx vck serve # or: uvx vivechak serve # Universal Agent Skill (Claude Code, Cursor, Antigravity, OpenCode) npx skills add bhaskarjha-dev/vivechak # Docker / Cloud Agents (Devin, OpenHands, CI) docker run -i --rm --user "$(id -u):$(id -g)" -e VIVECHAK_PROJECT_ROOT=/workspace -v "${PWD}:/workspace" ghcr.io/bhaskarjha-dev/vck:latest serve ``` **Or Native Install via Package Managers:** ```markdown # Homebrew (macOS & Linuxbrew) brew install --cask bhaskarjha-dev/tap/vivechak # Windows (WinGet or Scoop) winget install bhaskarjha-dev.Vivechak scoop bucket add vivechak https://github.com/bhaskarjha-dev/scoop-bucket && scoop install vivechak # Debian / Ubuntu (.deb) & Fedora / RHEL (.rpm) sudo dpkg -i vivechak_0.1.0_linux_amd64.deb # Debian / Ubuntu sudo rpm -i vivechak_0.1.0_linux_amd64.rpm # Fedora / RHEL # Nix / NixOS nix run github:bhaskarjha-dev/vivechak # Direct Shell Installers curl -fsSL https://vivechak.bhaskarjha.dev/install.sh | bash # macOS/Linux irm https://vivechak.bhaskarjha.dev/install.ps1 | iex # Windows ``` **Or Build from Source (Go 1.26+, toolchain Go 1.26.11):** ```markdown # Clone and build locally with zero external C dependencies: git clone https://github.com/bhaskarjha-dev/vivechak.git cd vivechak make build # builds production-optimized vck and vivechak binaries (-s -w stripped) # Or manually: # go build -trimpath -ldflags="-s -w -X github.com/bhaskarjha-dev/vivechak/internal/version.Version=0.1.0" -o vck ./cmd/vivechak/ # Optional: Install to PATH or run directly ./vck version # (or .\vck.exe on Windows) ``` Or install via Go toolchain: ```markdown go install github.com/bhaskarjha-dev/vivechak/cmd/vivechak@latest ``` ### 2. Configure Your AI Host Configure your AI host or editor in 1 second using the official shorthand **`vck`** (or `vivechak`): ```markdown # Fast setup for your AI host / IDE: vck setup cursor # Cursor IDE vck setup vscode # VS Code (Copilot Agent mode) vck setup claude # Claude Desktop vck setup agy # Google Antigravity vck setup # auto-detect host in current workspace # Or output universal MCP JSON configuration: vck mcp-config ``` *(For every preset, terminal harnesses, or manual configs, see the [Host Setup Guide](HOST-SETUP.md).)* ### 3. Prompt Your AI Agent Based on Scope (or Use Slash Commands) Open your agent chat in your project repository and choose your scope (or invoke native **MCP Slash Commands** in compatible clients): - **For Quick Comparisons (~5 mins, 1 session):** > `/compare` or *"Vivechak compare: Pino vs Winston for high-throughput Node.js microservices."* - **For Architectural Decisions (~30 mins, 1–3 sessions):** > `/decision` or *"Vivechak decision: Should we migrate our primary analytics datastore from PostgreSQL to ClickHouse?"* - **For Full Project Pipelines (Hours–Days, greenfield architecture):** > `/project` or *"Use Vivechak to research our architecture. We need to build a multi-tenant B2B SaaS analytics platform ingesting 20M events/day."* - **For Pre-Code Phase 0 Gate Evaluation:** > `/gate` or *"Evaluate Phase 0 Gate before implementation."* > **Note:** **When NOT to use Vivechak:** Do NOT invoke Vivechak for routine coding, writing functions, debugging errors, or syntax explanations. Let your agent write code directly without research tools. ### 4. How the Agent Executes Each Scope - **Comparison Scope:** Agent calls `vivechak_start(scope="comparison", question="...")` → executes prompt with search → calls `vivechak_save(kind="comparison", content="")` to persist WEP matrix in `research/C-NNN-comparison.md`. Done in 5 minutes! Zero DAG, zero gate. - **Decision Scope:** Agent calls `vivechak_start(scope="decision", question="...")` → saves plan via `vivechak_save(kind="plan", id="D-NNN", content="")` → runs 1–3 sessions → calls `vivechak_record_decision(id="D-NNN", content="")` to record canonical ADR `research/D-NNN-decision.md` and compiled registry `research/DECISIONS.md`. Zero project DAG, zero FAD. - **Project Scope:** Autonomous orchestration across 9 consolidated tools: ```markdown [Agent: vivechak_start(scope="project", question="")] └─ Initializes research/ workspace and returns actionable DAG generator brief [Agent: executes generator prompt] └─ Generates RESEARCH-PIPELINE.md (DAG) & DECISIONS.md (registry) [Agent: vivechak_save(kind="plan", id="DAG", content="")] └─ Validates DAG dependencies & persists research plan [Agent: Execution Loop] ├─ vivechak_next() ──> Injects upstream findings into next ready prompt ├─ [Agent executes deep research with web search] ├─ vivechak_save(kind="session", id="T1-01", content="") ──> Validates evidence grades (A-E) └─ vivechak_record_decision(id="D-001", content="") ──> Records ADR [Agent: FAD Synthesis (SYN-01)] └─ Synthesizes all findings into research/FAD.md via vivechak_save(kind="fad", id="SYN-01", content="") [Agent: vivechak_gate() (or CLI: vck gate)] └─ Evaluates Phase 0 Exit Gate across Track A and Track B (Rules G1–G12) ``` See the [MCP Tools Reference](MCP-TOOLS.md) for full tool schemas, parameter specs, and error handling. ### Upgrade & Uninstall **To upgrade Vivechak:** - **Homebrew (macOS & Linux):** `brew update && brew upgrade --cask bhaskarjha-dev/tap/vivechak` - **Windows (PowerShell):** Re-run installer: `irm https://raw.githubusercontent.com/bhaskarjha-dev/vivechak/main/install.ps1 | iex` - **Linux / macOS Shell:** Re-run installer: `curl -fsSL https://raw.githubusercontent.com/bhaskarjha-dev/vivechak/main/install.sh | sh` - **WinGet / Scoop:** `winget upgrade bhaskarjha-dev.Vivechak` or `scoop update vivechak` - **Go toolchain:** `go install github.com/bhaskarjha-dev/vivechak/cmd/vivechak@latest` - **Zero-install runners (`npx` / `uvx`):** Always run the latest package automatically. **To uninstall:** 1. **Remove binary:** - Homebrew: `brew uninstall --cask bhaskarjha-dev/tap/vivechak` - WinGet / Scoop: `winget uninstall bhaskarjha-dev.Vivechak` or `scoop uninstall vivechak` - Shell / Manual: Delete `vck` (and `vivechak`) from your binary directory (e.g. `~/.local/bin/vck` or `%LOCALAPPDATA%\Programs\vivechak\vck.exe`). 2. **Remove MCP configuration:** - Delete the `"vivechak"` block from your host config file (e.g. `.cursor/mcp.json`, `.vscode/mcp.json`, `~/.claude.json`), or restore the automatic `.vivechak-bak-` backup created during `vck setup`. ## Path B: Manual Workflow (No Installation Needed) No binaries or CLI required. Works in ChatGPT, Gemini, or Claude web browsers with web search enabled. ### 1. Copy the Generator Prompt Open [`GENERATOR-PROJECT.md`](../GENERATOR-PROJECT.md) and copy the generator prompt inside the markdown code block. ### 2. Paste & Run with Your Project Vision Paste the prompt into Claude, ChatGPT Plus, or Gemini Advanced (with search enabled). Fill in `[PASTE YOUR PROJECT DESCRIPTION HERE]`: ```markdown Project: Multi-tenant SaaS analytics platform. Workload: 20M event writes/day, 95th percentile query latency < 500ms for dashboards. Tenants: 500 B2B customers, strict tenant data isolation required. Candidates: PostgreSQL + TimescaleDB vs ClickHouse vs DynamoDB. Constraints: Team knows Postgres well; small DevOps team (managed cloud preferred). ``` ### 3. Save the Two Generated Files The AI returns two separate documents. Create a `research/` directory in your project root and save: 1. `research/RESEARCH-PIPELINE.md` (the session DAG and copy-paste prompts) 2. `research/DECISIONS.md` (the decision registry) ### 4. Copy the Scope-Appropriate Templates For a full project pipeline, copy all 6 templates from `templates/` into your project's `research/templates/`: - **`DECISIONS.template.md`** - **`CONFLICT-RESOLUTION.template.md`** - **`COMPARISON-SESSION.template.md`** - **`FOUNDING-ARCHITECTURE.template.md`** - **`PHASE-0-GATE.template.md`** - **`SESSION.template.md`** *(Note: For a single decision scope, you only need the first 2 templates. For a bounded comparison, you only need `COMPARISON-SESSION.template.md`.)* Your project workspace is now completely self-contained: ```markdown my-saas-project/ └── research/ ├── RESEARCH-PIPELINE.md ├── DECISIONS.md ├── sessions/ └── templates/ ``` ### 5. Execute, Record, Synthesize & Gate 1. **Execute Sessions:** Copy each prompt from `RESEARCH-PIPELINE.md` into an AI deep research session. Save each result to `research/sessions/.md`. 2. **Record Decisions:** Fill in `research/DECISIONS.md` as sessions complete. Classify decisions as **Two-Way Doors** (reversible) or **One-Way Doors** (irreversible, requiring explicit reversal triggers). 3. **Synthesize & Gate:** Compile findings into `FAD.md` using `FOUNDING-ARCHITECTURE.template.md`, then run the checklist in `PHASE-0-GATE.template.md` before writing code. For complete step-by-step instructions, see the [Manual Workflow Guide](MANUAL-WORKFLOW.md). ## Smaller Scope: When You Don't Need a Full Pipeline Not every technical choice requires a full 4–30 session project pipeline. ### Single Decision (1–3 Sessions → ADR) Use [`GENERATOR-DECISION.md`](../GENERATOR-DECISION.md) when you have one specific dilemma. - **Example:** *"Should we use PostgreSQL or ClickHouse for our SaaS analytics datastore?"* - **What it does:** Profiles reversal cost (R), novelty (N), blast radius (B), and regulatory risk (X). Generates 1–3 targeted session prompts (`L` landscape, `C` comparison, `F` falsification) and a pre-populated ADR skeleton (`D-001-datastore.md`). ### Quick Comparison (1 Session → WEP Matrix) Use [`GENERATOR-COMPARISON.md`](../GENERATOR-COMPARISON.md) when comparing 2–5 defined options on known criteria. - **Example:** *"Compare Redis vs Dragonfly vs KeyDB for cache clustering."* - **What it does:** Emits a single research prompt producing a Weighted Evaluation Matrix (WEP), sensitivity testing (±20% weight variations), concrete failure modes, and disconfirming evidence. ## Key Methodology in 30 Seconds - **Evidence Grades (A–E):** every factual claim carries one: - **Grade A (Primary Empirical):** Official specifications, canonical source code, RFCs, or primary documentation with explicit URL anchor. - **Grade B (Secondary Empirical):** Peer-reviewed papers, reproducible third-party benchmarks, published postmortems, or corroborated engineering reports. - **Grade C (Vendor & Practitioner):** Vendor marketing, product whitepapers, vendor benchmarks, conference talks, or interested-party documentation. - **Grade D (Informal & Opinion):** Blog posts, forum discussions, StackOverflow answers, or model memory recall (capped at Grade D). - **Grade E (Speculative & Unsubstantiated):** Unverified hypotheses, uncorroborated parametric recall, or ungrounded assertions. - **Two-Way vs. One-Way Doors:** Two-Way doors (reversal cost low) need ~70% confidence and run fast. One-Way doors (persistence schemas, data migrations, public API contracts) require corroborated Grade A/B evidence, falsification checks, and locked reversal triggers. - **Structured Falsification:** Prompts explicitly direct the AI to hunt for failure modes and disconfirming evidence against the leading candidate, preventing confirmation bias. ## Next Steps - Setting up your editor? Check [Host Setup Guide](HOST-SETUP.md). - Building with AI agents? See [MCP Tools Reference](MCP-TOOLS.md). - Running manually in web chats? See [Manual Workflow Guide](MANUAL-WORKFLOW.md). - Deep dive into methodology? Read the complete [Framework Specification](../FRAMEWORK.md). --- # The Three Scopes — Comparison, Decision & Project > Calibrate research investment to reversal risk: 1-session WEP matrix (5 min), 1–3 session ADR (30 min), or multi-session DAG pipeline. ## Overview ### Complete Specification for Evidence-Grounded Technical Research *Version 0.1.0 — Empirically Validated via 11 Meta-Research Sessions* ## Executive Philosophy & The Three Research Scopes > **Note:** **The Research-First Law:** *Investigate irreversible architectural decisions and comparative choices with graded, verifiable evidence — whether architecting a new system on Day 0, resolving an architectural dilemma on Day 30, or evaluating competing technologies on Month 6. Develop nothing based on cached assumptions, outdated training data, or hallucinated consensus.* Technical failures and architectural rewrites are rarely caused by poor implementation — they are caused by **premature decisions made on unverified assumptions.** Vivechak is an evidence-grounded research meta-framework that discovers, evaluates, resolves, and grounds technical decisions across the software lifecycle. ### The Three Research Scopes Vivechak operates at three distinct scope levels calibrated to decision blast radius: ```markdown ┌──────────────────┬──────────────────┬──────────────────┬────────────────────────┐ │ 1. Comparison │ 2. Decision │ 3. Project │ 4. OUT OF SCOPE │ │ (WEP Matrix) │ (ADR D-NNN) │ (FAD Pipeline)│ (NO Vivechak) │ ├──────────────────┼──────────────────┼──────────────────┼────────────────────────┤ │ • 1 session │ • 1–3 sessions │ • 4–30 sessions │ • 0 sessions │ │ • ~5 minutes │ • ~30 minutes │ • Full pipeline │ • Direct execution │ │ • 0 DAG │ • 0 DAG │ • Topological DAG│ • Zero ceremony │ │ • 0 FAD / 0 Gate │ • 0 FAD │ • FAD + Phase 0 │ • No MCP tools called │ │ • 1 template │ • 2 templates │ • 6 templates │ │ └──────────────────┴──────────────────┴──────────────────┴────────────────────────┘ ``` 1. **Comparison Scope (`GENERATOR-COMPARISON.md`):** Rapid evaluation between 2–5 options producing an evidence-graded Weighted Evaluation Protocol (WEP) matrix in a single session without DAG or gate overhead. 2. **Decision Scope (`GENERATOR-DECISION.md`):** Focused investigation for an architectural dilemma in an existing project, producing a validated Architectural Decision Record (ADR) in 1–3 sessions. 3. **Project Scope (`GENERATOR-PROJECT.md`):** Greenfield system architecture or major platform rewrite, decomposing uncertainty into an information DAG, synthesizing findings into a Founding Architecture Document (FAD), and verifying pre-codebase exit criteria via the Phase 0 Gate. *(For detailed scope methodology, invariants I1–I9, and decision routing, see [§9. Multi-Scope Research](#9-multi-scope-research).)* ### Positioning: What Vivechak Is vs. What Vivechak Is Not | What Vivechak IS | What Vivechak IS NOT | | --- | --- | | **Epistemic Grounding Engine:** Pre-coding research meta-framework providing empirical evidence grades (`E-A` through `E-E`) | **A Code Generator:** It does not write production code, components, endpoints, or scripts | | **Architectural Gatekeeper:** Enforces pre-coding exit criteria (`Track A` Two-Way vs. `Track B` One-Way Doors) with interactive human sign-off (`vck signoff`) | **A Linter or Static Analyzer:** It does not analyze ASTs, enforce formatting, or typecheck code | | **Reversibility-Calibrated Sieve:** 1-session comparisons (`C-NNN`), 1–3 session ADRs (`D-NNN`), or multi-session DAG pipelines | **An Autonomous Orchestrator for Everything:** Not an open-ended loop for routine programming tasks | | **Structured Falsification:** Mandates disconfirming evidence searches, substantive discovered concerns, and premortems | **A Prompt Persona:** No expert persona roleplays, XML prompt bloat, or arbitrary search count quotas | ### How Project Scope Operates (Full Pipeline) ```markdown PROJECT VISION │ ▼ ┌─────────────────────────────────────────────────────┐ │ COMPLEXITY SCORING (8 dimensions, 0–24 pts) │ │ → Determines research depth tier (0–3) │ │ → Routes each decision by reversibility │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ CONSTRAINED DAG EXECUTION │ │ Sessions run when dependencies are satisfied │ │ Default: unblocked. Hard deps block; soft don't. │ │ Adaptive checkpoints expand/contract scope │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ STAGED TRIANGULATION & EVIDENCE GRADING │ │ Single-model default → critique probe → │ │ full triangulation (One-Way Doors only) │ │ A–E grades + modifiers + verification tracking │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ TWO-TRACK PHASE 0 GATE │ │ Track A: Fast-track for Two-Way Doors │ │ Track B: Rules G1–G11 gate + premortem for One-Way Doors │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ FOUNDING ARCHITECTURE DOCUMENT (FAD) │ │ Map-Reduce synthesis → sealed specification │ │ → Repository scaffolding begins │ └─────────────────────────────────────────────────────┘ ``` ## Core Principles Vivechak v0.1.0 is governed by 8 evidence-grounded principles. Each was empirically validated through the meta-research pipeline and cites its supporting evidence. ### P1: The Context Architecture Law *Supersedes: pre-validation Aspect-Isolation Law* Research quality is governed by **attention budget, context purity, and task boundaries** — not by arbitrary session counts. The constraint is real (token/search budget is the dominant predictor of performance on web research benchmarks — OpenAI BrowseComp scaling analysis), but the remedy is conditional decomposition, not blanket fragmentation. **Rules:** - Decompose into dedicated research contexts when sub-tasks have low interdependency, high individual complexity, or divergent search spaces. - Integrate coupled topics into structured joint sessions when evaluating holistic system tradeoffs. - Every decomposed investigation **must** conclude with an explicit downstream synthesis pass. - Over-isolation triggers the split-attention effect, introduces 4–15× token overhead, and misses systemic cross-cutting trade-offs. > **Note:** **Evidence:** E-001 (OpenAI BrowseComp — accuracy scales with search budget/compute), E-002 (MTI +12.4% on joint tasks), E-003 (Chandler & Sweller split-attention), E-004 (Chroma context rot) > **Note:** **Terminology note:** P1 aligns with the 2025-2026 "context engineering" paradigm — the systematic design of what information reaches a model's context window, in what form, and at what priority. Vivechak's decomposition-by-attention-budget and synthesis-after-decomposition rules are specific operational principles within that broader discipline. ### P2: Reversibility-Calibrated Rigor The depth of research, evidentiary burden, and review overhead allocated to a decision must scale directly with its **reversibility and blast radius**. | Door Type | Definition | Research Depth | Evidence Bar | | --- | --- | --- | --- | | **One-Way (Type 1)** | Consequential, costly/impossible to reverse (primary datastore, data model, auth architecture, core language/runtime, regulatory compliance, public API contracts, hosting infrastructure, deployment architecture) | Deep research, multi-session, corroborated evidence | Grade A/B, human review, premortem | | **Two-Way (Type 2)** | Cheap, fast to reverse (UI framework, styling, CI tooling, non-core utility libraries) | Fast spike or convention decision on ~70% information | Grade B/C acceptable, no gate required | > **Note:** **Evidence:** E-010 (Cynefin), E-011 (DORA defect concentration), E-012 (Amazon Type 1/2 doors) ### P3: Evidentiary Grounding & Verification Provenance No technical assertion or architectural decision may be accepted without: - An explicit **evidence grade** (A through E) - **Provenance tracking** (`verification_method`: fetched, cached, recalled, secondhand, human-provided) - **Contextual modifiers** (corroboration, recency, directness) **Hard rule:** Unverified AI parametric recall is capped at Grade D. Zero recalled citations may support One-Way Door decisions. > **Note:** **Evidence:** E-013 (GRADE framework), E-014 (Admiralty Code collapse), E-015 (AI citation confabulation) ### P4: Prescriptive Scope, Dynamic Method *Supersedes: pre-validation 8-section XML prompt anatomy* Research briefs must be: - **Prescriptive** on WHAT to investigate, WHY it matters, WHAT boundaries apply, and WHAT coverage is required. - **Directional** on HOW to execute: no pre-scripted search queries, no artificial search counts, no expert role-playing personas, no rigid output skeletons. **Bounded Exploration Mandate:** Prescriptive scope defines the **minimum coverage floor**, not a ceiling. If research reveals critical concerns, risks, dependencies, or opportunities beyond the stated scope that are material to the decision being informed, the researching agent should investigate and include them — justified with evidence. This prevents the "hyper-literalism" effect where frontier models constrain their native reasoning to only the explicitly listed elements, missing emergent or adjacent concerns the prompt author could not have anticipated. Front-load the complete brief in a single turn. Never drip-feed instructions across multiple turns (39% performance drop documented). > **Note:** **Evidence:** E-017 (Laban et al. ICLR 2026, 39% multi-turn drop), E-018 (persona debunking), E-019 (ReAct paradigm), E-020 (format restriction penalty) **Audience framing vs. persona assignment:** Specifying the target audience (e.g., "a Principal Architect needing production-grade tradeoffs") sets the QUALITY BAR for the output. This is distinct from persona assignment (e.g., "You are an expert database engineer"), which attempts to alter the model's reasoning behavior. Audience framing is prescriptive scope (WHAT quality level); persona assignment is method prescription (HOW to think). The former is permitted under P4; the latter is empirically refuted. **The Zero-Tooling Boundary (Out-of-Scope Protection):** Vivechak's evidentiary rigor applies strictly to technical choices, comparisons, architectural evaluations, and system design. It must **never** be invoked for routine code implementation, syntax questions, local debugging, or micro-refactoring. Applying research ceremonies to everyday programming triggers cognitive friction, slows development, and wastes model attention budget. ### P5: Commodity-Maximized Composition *Supersedes: pre-validation fixed ~40/60 ratio* - **Compose 100%** of commodity/utility components from battle-tested providers (Auth, DB, Storage, Queues, UI primitives, CI/CD). - **Build 100% custom** only for proprietary domain intelligence, core state machines, differentiated business logic, and unique algorithms. The ratio varies by domain. Use Wardley evolution mapping, not fixed percentages. > **Note:** **Evidence:** E-024 (Wardley mapping), E-025 (Fowler MonolithFirst), E-026 (DORA loosely-coupled architecture) ### P6: Dual-Audience Artifact Architecture Research outputs must serve both human readers and machine consumers: - **Hybrid Markdown + YAML frontmatter** — human-readable body with machine-parseable metadata. - **Standardized 7-section H2 skeleton** — consistent structure enabling automated Map-Reduce synthesis. - **Strict separation** between `Recommendation` and `Alternatives Considered` — prevents AI code-generation contamination from rejected options. > **Note:** **Evidence:** E-021 (MADR 4.0), E-022 (GraphRAG header chunking), E-023 (Git diff mechanics) ### P7: Staged Triangulation & Diagnostic Disagreement *Supersedes: pre-validation mandatory 3-model triangulation* Multi-model consensus is an **escalation tool, not a mandatory ritual**. | Stage | When | Method | | --- | --- | --- | | **Default** | All sessions | Single-model deep research | | **Critique Probe** | Medium-stakes decisions | Feed Pass 1 output to a second model for adversarial critique | | **Full Triangulation** | One-Way Doors + Novel Domain + Genuine Contestation | Run identical prompt across 2–3 models; synthesize divergence via ACH matrix | Disagreement is treated as a **diagnostic signal** of problem ambiguity, not a vote to average out. > **Note:** **Evidence:** E-005 (Kim et al. ICML 2025, 60% correlated errors), E-006 (Gao & Xiao, model house styles), E-007 (Lorenz et al. crowds breakdown) ### P8: Structured Falsification & Diagnostic Review Architectural analysis must prioritize **falsification over confirmation**. - Research prompts must explicitly seek disconfirming evidence against favored options. - Decision records must document rejected alternatives with causal rationale. - Every locked ADR must carry a `review_trigger` — explicit conditions or dates for mandatory re-evaluation. - One-Way Doors require a **Gary Klein Premortem** before commitment. - Every One-Way Door ADR should carry a `review_date` set BEFORE the outcome is known, and an optional `prediction` field recording the expected outcome. Post-project retrospectives compare predictions to actuals — without this closing loop, decision calibration can never improve over time. > **Note:** **Evidence:** E-028 (Mitchell, Russo & Pennington 1989 prospective hindsight, 30% risk identification improvement; popularized as the Premortem by Klein 2007), Heuer's ACH, Annie Duke decision journaling ## Pipeline Architecture ### 3.1 Topology: Constrained DAG with Adaptive Checkpoints Vivechak v0.1.0 replaces rigid stage gating with a **Directed Acyclic Graph** governed by explicit information dependencies. #### The Inverted Dependency Default Every research session defaults to **unblocked** (eligible to execute immediately) unless an explicit hard information dependency is declared. #### Dependency Classification | Type | Definition | Effect | | --- | --- | --- | | **Hard (Information)** | Session B literally cannot formulate valid outputs without an artifact from Session A | Blocks execution — DAG edge | | **Soft (Contextual)** | Session B benefits from terminology or constraints from Session A | No blocking — inject a Shared Context Brief (a concise summary of relevant terminology, constraints, and preliminary findings from upstream sessions, included in the prompt's BRIEF block) | #### Dependency Injection Protocol When injecting upstream session outputs as context for downstream sessions: 1. **Extract only the specific information** declared in the dependency specification — typically 3–5 sentences summarizing the relevant decision, finding, or constraint. 2. **Do NOT attach full research artifacts** as context. A 10,000-word research report should be condensed to the specific findings the downstream session needs. 3. **Label the dependency type** in the downstream prompt: - **Constrains:** The upstream decision must be respected (e.g., "Database: PostgreSQL 16 — this is a locked One-Way Door decision") - **Informs:** The upstream finding provides context but should not limit independent evaluation (e.g., "Prior research found latency under 50ms at current scale — verify independently") 4. **Minimizing dependencies maximizes parallelism.** Most Layer 0 and many Layer 1 sessions can run concurrently. Reserve hard dependencies for genuine information prerequisites. 5. **Context Injection Slots:** In automated orchestration (MCP server), prompt templates include explicit slots: - `[UPSTREAM_FINDINGS]`: Injected into downstream session prompts with upstream decisions and evidence. - `[ALL_SESSION_FINDINGS]`: Injected into the final grand synthesis prompt (`SYN-01`) aggregating all completed session findings. #### Adaptive Checkpoints - **Expansion:** If a session reveals unexpected Cynefin-Complex trade-offs, spawn a maximum of 2 child sub-sessions. - **Contraction:** If a planned session's core question has been authoritatively resolved upstream, close it immediately. - **Incremental Synthesis:** Partial FAD compilation begins as soon as any structural branch closes. #### Pipeline Termination Criteria A research pipeline may be terminated early when ALL of the following are met: - Every identified One-Way Door decision has a locked ADR with Grade A/B evidence. - No remaining unexecuted sessions would inform an unresolved One-Way Door. - All executed sessions have produced actionable recommendations (not vague summaries). - No outstanding `contested` corroboration flags remain on critical claims. Termination does NOT require executing every planned session. Two-Way Door sessions that remain unexecuted at termination are decided by convention and logged as Track A decisions. #### Pipeline Failure Modes When a research pipeline encounters problems, apply these recovery protocols: **Session produces garbage (vague summaries, hallucinated citations, off-topic output):** 1. Check the prompt — is the BRIEF clear on WHAT to learn and WHY it matters? 2. Try a different model (Gemini → Claude → ChatGPT). Model strengths vary by domain. 3. If the topic is too broad, split into 2 focused sub-sessions. 4. If the model lacks web access, the output will be parametric recall at best — cap at Grade D and note `verification_method: recalled`. **Synthesis deadlocks (sessions produce contradictory recommendations with equal evidence):** 1. This is expected, not a failure. Use `templates/CONFLICT-RESOLUTION.template.md` — the ACH matrix is designed for exactly this. 2. Check whether the contradiction is real (different evidence) or apparent (different scoping assumptions). 3. If evidence is genuinely equal, classify by reversibility: Two-Way Door → pick either and spike; One-Way Door → escalate to triangulation (run the same prompt on a second model). 4. If deadlock persists after triangulation, the decision may be in the Cynefin Complex domain. Consider a technical spike instead of more research. **Gate reveals gaps (Phase 0 checklist fails on specific items):** 1. Identify which One-Way Doors lack adequate evidence. 2. Spawn targeted follow-up sessions for those specific gaps — do NOT re-run the entire pipeline. 3. If gaps are in Two-Way Door decisions, decide by convention (Track A) and move forward. 4. If gaps indicate the project vision itself is unclear, pause and clarify scope before spawning more sessions. #### Progressive Elaboration Protocol For Tier 2–3 projects where research may span weeks, the project vision may evolve mid-pipeline. When new constraints, pivots, or stakeholder feedback emerge: 1. **Update the RESEARCH-PIPELINE.md** with a dated amendment section noting the change. 2. **Assess impact on existing sessions:** If completed sessions are invalidated, mark their ADRs as deprecated with superseded_by linking to new sessions. 3. **Add or modify sessions** in the DAG to address new concerns. New sessions follow the same tier-appropriate rigor. 4. **Do NOT restart the pipeline from scratch** unless the fundamental project vision has changed (e.g., pivot from B2B to B2C). Incremental amendment preserves completed research investment. This protocol balances research continuity with responsiveness to change — a core tenet of evidence-grounded decision-making. ### 3.2 Adaptive Scaling Model #### 8-Dimension Complexity Scoring (0–24 Points) | Dimension | 0 (Low) | 1 (Moderate) | 2 (Substantial) | 3 (Extreme) | | --- | --- | --- | --- | --- | | **Domain Novelty** | Standard pattern (e.g., CRUD / retail) | Established category (e.g., B2B SaaS, standard protocol) | Unconventional workflow / model | New category / paradigm | | **Technical / Operational Novelty** | Known stack / standard process | Familiar platform, new component | New framework / workflow paradigm | Unproven infra / model | | **Regulatory Exposure** | Zero sensitive data / standard rules | Internal data | PII, GDPR, SOC 2, financial | HIPAA, PCI-DSS, KYC/AML, SEC | | **Reversibility** | Throwaway / easily swapped | Modularly swappable | Core schema / key contracts | Deep platform / legal lock-in | | **Investment Horizon** | Hackathon / weekend spike | Lean MVP / internal tool | Funded venture | Enterprise mission-critical | | **Coordination Complexity** | Single decision-maker | Small team alignment (2–4) | Cross-team / cross-function (5–12) | Multi-org / ecosystem (>12) | | **Expected Longevity** | Days to weeks | Months (prototype) | 1–3 years (product) | 5+ years (platform) | | **Integration Complexity** | Standalone | 1–2 external interfaces (APIs, feeds) | Multiple complex integrations | Regulated rails / legacy systems | #### Tier Mapping | Score | Tier | Session Budget | Character | | --- | --- | --- | --- | | **0–4** | Tier 0: Minimal | 1–3 sessions | Fast spike on core unknown | | **5–9** | Tier 1: Light | 4–8 sessions | Standard SaaS/internal tools | | **10–15** | Tier 2: Standard | 9–16 sessions | Commercial product with core ADRs | | **16–24** | Tier 3: Deep | 17–30 sessions | Novel, regulated, multi-tenant platform | **What constitutes a "session":** A session is one independent research execution — a single prompt sent to a frontier AI model's deep research mode, producing one complete output artifact. Sessions are calibrated for deep research modes that perform 20–100+ web searches per run. If using standard (non-deep-research) chat, a single "session" may require multiple conversational turns to achieve equivalent depth — adjust session budgets accordingly. The tier budgets are relative proportions between tiers, not absolute figures to copy without calibration for your specific tools and workflow. > **Note:** **🚨 Hard Override:** If Regulatory Exposure = 3, all intersecting decisions automatically receive Tier 3 treatment regardless of total score. **Rubric calibration:** The 0–3 scales and tier boundaries are structured heuristics, not calibrated measurement instruments. After completing 2–3 projects, compare the assigned tier to the actual research effort required. If projects consistently need more depth than their tier suggests, adjust boundaries upward. If sessions are routinely closed early because the question was already answered, adjust downward. The rubric should evolve with your team's experience — treat it as a living instrument, not a fixed table. #### Per-Decision Routing Matrix | | **Known Pattern** | **Unknown / Novel** | | --- | --- | --- | | **Reversible (Two-Way Door)** | **SKIP** — decide by convention | **FAST SPIKE** — 1 timeboxed session | | **Irreversible (One-Way Door)** | **CONFIRM & COMMIT** — 1 session + ADR | **DEEP RESEARCH** — 2–5 sessions + ADR + premortem | ### 3.3 Staged Triangulation Protocol | Stage | Trigger | Method | Cost | | --- | --- | --- | --- | | **Default** | All sessions | Single-model deep research | 1× | | **Critique Probe** | Medium-stakes decisions | Feed Pass 1 synthesis to Model B for adversarial critique | 1.3× | | **Full Triangulation** | One-Way Doors + Novel Domain + Genuine Contestation | Run identical prompt on 2–3 models; synthesize divergence via ACH matrix | 3× | ## Research Prompt Design ### 4.1 The 8-Block Prompt Anatomy | Block | Purpose | Prescriptive or Directional? | | --- | --- | --- | | **DECISION** | What architectural decision this feeds, door type (one-way/two-way), reversal condition | **Prescriptive** — anchors session to purpose | | **BRIEF** | Investigation goal, question kind (lookup/causal/evaluative), context, target audience | **Prescriptive** — what and why | | **SCOPE** | Boundaries, time window, in/out scope, source priorities, date anchor | **Prescriptive** — boundaries | | **KNOWN** | Upstream findings slot (`[UPSTREAM_FINDINGS]`) or starting assumptions to stress-test | **Prescriptive** — inherited baseline | | **CALIBRATION** | 5 epistemic calibration rules: memory as hypothesis, honest gaps, expert objections | **Directional** — epistemic discipline | | **APPROACH** | Exploration strategy (DEEPEN, WIDEN, CORROBORATE, FALSIFY, PIVOT), research depth mandate, iterative guidance, domain probes | **Directional** — guide how, don't prescribe | | **DONE** | 3-5 quality-based completion criteria (primary answer, grounded tradeoffs, failure modes, reversal conditions) | **Prescriptive** — definition of done | | **FORMAT** | Single complete Markdown file artifact with YAML frontmatter and standard section flow | **Prescriptive** — output structure | #### What Was Removed and Why | Pre-validation Element | Verdict | Evidence | | --- | --- | --- | | `` expert persona | **Removed** — personas don't improve factual accuracy | Zheng et al. EMNLP 2024; Basil et al. 2025 | | `` hardcoded queries | **Removed** — violates agentic ReAct loop | Yao et al. 2023; OpenAI BrowseComp scaling analysis | | `` negative instructions | **Removed** — triggers ironic "white bear" rebound | Documented in T2-06 | | `` rigid sections | **Replaced** with coverage checklist | Tam et al. EMNLP 2024 | | Minimum search counts | **Removed** — artificial floors don't match model judgment | T1-02 | | Multi-turn drip-feeding | **Banned** — front-load everything in one turn | Laban et al. ICLR 2026 (39% drop) | ### 4.2 Standard Prompt Template ```markdown # RESEARCH BRIEF: [Topic Title] ## DECISION [Neutral decision question]; informs [D-NNN: Title]. Door: [one-way | two-way]. What would change the recommendation: [reversal condition]. ## BRIEF We are investigating [core technical/architectural question]. Question type: [lookup | causal | evaluative]. This research will directly inform Architectural Decision [D-NNN: Title]. The target audience is a Principal Architect requiring rigorous, production-grade technical evaluation with concrete tradeoffs, operational failure modes, and verified benchmarks — not high-level introductory summaries. Context (requester-stated, unverified): [context]. ## SCOPE - **Temporal Anchor:** Today's date is [YYYY-MM-DD]. Focus on developments within the last 18–24 months. Flag findings older than [date] as potentially stale. - **In Scope:** [Explicit boundary 1], [boundary 2], [boundary 3]. - **Out of Scope:** [Explicit exclusion 1], [exclusion 2]. - **Source Priorities:** Prioritize primary sources (official docs, RFCs, source code, peer-reviewed benchmarks) over secondary aggregators, blogs, and vendor claims. ## KNOWN [UPSTREAM_FINDINGS] — treat inherited claims as assumptions to stress-test, not settled facts. Key assumptions this session starts with (requester-stated, unverified): [assumptions]. ## CALIBRATION 1. Treat your memory as a hypothesis to test. Note initial beliefs; report what evidence confirmed, updated, or contradicted. 2. A significant claim is most valuable when grounded with a verifiable source. "Not found after searching X, Y, Z" is a valid, valued result. 3. An unsupported claim presented as fact costs more than an honest gap. 4. Before finishing: state the strongest objections an expert would raise and what evidence you found for or against each. 5. Distinguish what you found from what you recalled. Mark recalled claims honestly — they are starting points, not conclusions. ## APPROACH Use the research move that fits each question: - DEEPEN: trace a claim to its primary source - WIDEN: search with different vocabulary or source types - CORROBORATE: find independent support for a load-bearing claim - FALSIFY: actively search for evidence against your leading answer - PIVOT: reframe the question when results suggest the framing is wrong - Do NOT limit yourself to the exact terms in the research question. Use ALLIED TERMS: synonyms, competitor names, failure modes, edge cases. - Execute MULTIPLE SEARCH STRATEGIES per finding: Direct, Adversarial, Comparative, Community. - Target 8-12 SUBSTANTIVE findings with evidence grades, not 20 shallow bullet points. - For every recommendation, search for the STRONGEST ARGUMENT AGAINST it. - If your research reveals critical concerns beyond the stated scope, investigate and include them. ## DONE This session is complete when: 1. A recommendation is stated with evidence for the primary question. 2. Tradeoffs and options are evaluated with verifiable evidence citations. 3. At least one concrete failure mode per top contender is documented with the strongest disconfirming evidence found. 4. "What would change this recommendation" is answered with specific reversal triggers. 5. Discovered Concerns (if research revealed material concerns beyond stated scope). ## FORMAT Single Markdown file with YAML frontmatter (id, title, date, status, topic, tags, informs_decisions, confidence). Sections: Prior (pre-research beliefs: 3-5 checkable propositions "I believe [X] because [reasoning]") → Research Question → Key Findings (3-7 bullets) → Recommendation (isolated from rejected options) → Alternatives Considered → Detailed Findings → Open Questions & Risks → Delta (what research changed: table with Prior Belief | Status | Evidence | Impact) → Sources & Evidence Ledger. Filename: [Session-ID]-[slug].md ``` ### 4.3 Research Output Quality Rubric A research session output meets Vivechak's quality bar when it satisfies ALL of the following: | Criterion | Minimum Standard | | --- | --- | | **Evidence Density** | ≥3 distinct claims backed by Grade A or B evidence | | **Options Evaluated** | ≥2 competing options analyzed for comparison sessions | | **Failure Modes** | ≥1 concrete failure scenario identified per recommended option | | **Reversal Triggers** | Explicit conditions for when to re-evaluate the recommendation | | **Source Diversity** | Not all evidence from a single vendor or source | | **Disconfirming Evidence** | At least one actively sought disconfirming argument documented | Sessions failing this rubric should be re-executed with a refined prompt before their findings inform ADRs. ## Evidence & Decision System ### 5.1 Evidentiary Tiers (A through E) | Grade | Label | Description | Allowed Provenance | Gate Impact | | --- | --- | --- | --- | --- | | **Grade A** | Primary Empirical | Official specifications, canonical source code, RFCs, or primary documentation with explicit URL anchor. | `fetched, human-provided` | G6, G7 | | **Grade B** | Secondary Empirical | Peer-reviewed papers, reproducible third-party benchmarks, published postmortems, or corroborated engineering reports. | `fetched, cached` | G6, G7 | | **Grade C** | Vendor & Practitioner | Vendor marketing, product whitepapers, vendor benchmarks, conference talks, or interested-party documentation. | `fetched, cached` | Advisory | | **Grade D** | Informal & Opinion | Blog posts, forum discussions, StackOverflow answers, or model memory recall (capped at Grade D). | `fetched, cached, recalled` | Advisory | | **Grade E** | Speculative & Unsubstantiated | Unverified hypotheses, uncorroborated parametric recall, or ungrounded assertions. | `recalled, unverified` | Advisory | *Rule*: Parametric memory recall is capped at **Grade D**. Grade A requires canonical URL or specification anchor. *Gate*: G6 counts Grade A/B claims that sit on a line with their URL, written as the composite citation (§5.5), a bracketed grade tag (`[A · single · fresh · direct · fetched](url)`, `[Grade A: url | fetched]`) or an evidence-ledger row whose Grade cell is A or B; G7 counts those whose verification label is exactly `fetched` or `human-provided` (§7.2). ### 5.2 Contextual Modifiers | Modifier | Values | Purpose | | --- | --- | --- | | **Corroboration** | `single` · `corroborated` (≥2 independent sources) · `contested` (direct contradiction) | How many sources agree? | | **Recency** | `fresh` (within domain half-life) · `aging` (approaching half-life) · `stale` (past half-life) | Is this current? | | **Directness** | `direct` (exact workload/target) · `indirect` (analogical evidence) | Does this apply to our case? | **Domain Half-Life Guidance:** The threshold between `fresh` and `aging` varies by domain: - Cloud pricing and provider features: ~6 months - Framework/library APIs and benchmarks: ~12 months - Security advisories and CVEs: ~3 months - Database internals and query optimizers: ~18 months - Regulatory requirements (GDPR, HIPAA, PCI): ~24 months - Foundational CS/architecture principles: ~5+ years When in doubt, treat evidence as `aging` rather than `fresh`. ### 5.3 Verification Method | Method | Definition | Grade Cap | | --- | --- | --- | | `fetched` | Retrieved and validated live via tool/web call during this session | None | | `cached` | Read from local repository file or previously verified artifact | None | | `recalled` | Generated from model parametric memory without live verification | **Capped at Grade D** | | `secondhand` | Sourced from an article summarizing a primary source | None | | `human-provided` (or `human`) | Injected directly by a human engineer | None | ### 5.4 Hard Rules 1. **Recalled claims capped at Grade D** regardless of apparent source quality. 2. **Zero recalled citations may underpin One-Way Door decisions.** Every One-Way Door decision needs at least two Grade A/B claims with URLs whose verification is `fetched` or `human-provided` (gate rule G7); `cached` and `secondhand` claims may support it but do not count. 3. **Contested claims must be surfaced, not resolved by majority.** Document the contradiction and causal resolution reasoning. ### 5.5 Composite Citation Format ```markdown Claim text (Grade [A-E] · [corroboration] · [recency] · [directness] | [verification_method]) ``` Example: ```markdown PostgreSQL 16 logical replication supports bi-directional failover. (Grade B · corroborated · fresh · direct | fetched) ``` ### 5.6 Decision Confidence (Decoupled from Evidence Grade) | Confidence | Definition | | --- | --- | | `high` | Multiple corroborated Grade A/B sources; alternatives thoroughly evaluated | | `medium` | Adequate evidence but some alternatives lack evaluation, or key claims rest on single sources | | `low` | Decision under uncertainty; thin, contested, or indirect evidence | ### 5.7 Architecture Decision Records (D-NNN) Every architectural decision is documented as a YAML-frontmattered Markdown file: ```yaml --- id: D-001 title: "Primary Datastore Selection" status: accepted # proposed | accepted | rejected | deprecated | superseded door_type: one-way # Sets evidentiary bar date: 2026-08-18 confidence: high # Decoupled from evidence grade evidence_refs: [E-012, E-047] informed_by_sessions: [T2-03, T2-05] supersedes: null superseded_by: null amends: null review_trigger: "Re-evaluate if ingestion exceeds 50k ops/sec or storage >2TB" review_date: 2027-02-18 # Set BEFORE outcome is known prediction: "PostgreSQL will handle projected load for 18+ months" tags: [datastore, infrastructure] authored_by: "agent-vivechak" human_reviewed: true # Mandatory for one-way doors schema_version: "0.1.0" --- ``` **Required body sections:** 1. Context & Problem Statement 2. Evaluated Options (with evidence references) 3. Decision Outcome & Rationale 4. Rejected Alternatives & Tradeoffs 5. Failure Modes & Reversal Triggers ## Output Architecture ### 6.1 Hybrid Markdown + YAML Frontmatter Every research artifact combines: - **YAML frontmatter** — machine-parseable metadata - **Markdown body** — human-readable narrative with standardized section structure - **Strict separation** between `Recommendation` and `Alternatives Considered` ### 6.2 Standardized 9-Section Body Skeleton | # | Section | Purpose | | --- | --- | --- | | 1 | `## Prior` | Pre-research assumptions and starting beliefs (mitigates confirmation bias) | | 2 | `## Research Question` | Precise 1–2 sentence statement of inquiry | | 3 | `## Key Findings` | 3–7 atomic bullet points with inline evidence grades extractable by synthesis agents | | 4 | `## Recommendation` | Explicit guidance (isolated from rejected options, referencing evidence) | | 5 | `## Alternatives Considered` | Evaluated competing options and rejection rationale | | 6 | `## Open Questions & Risks` | Unresolved items, dependencies, and downstream risks | | 7 | `## Discovered Concerns` | Unexpected constraints, trade-offs, or failure modes outside initial scope (≥50 chars for one-way doors) | | 8 | `## Delta` | Tracking shift from prior beliefs (Confirmed / Contradicted / Updated) | | 9 | `## Sources & Evidence Ledger` | Tabular citations with composite grade, verification method, and claimed provenance | ### 6.3 Map-Reduce Synthesis Workflow When synthesizing research sessions into the Founding Architecture Document: ```yaml --- id: SYN-01 title: "[Project Name] — Founding Architecture Document" synthesis_date: YYYY-MM-DD status: draft # draft | sealed research_sessions_ingested: 0 # Count of final sessions ingested decisions_locked: 0 # Count of accepted ADRs open_questions: 0 # Count of unresolved questions schema_version: "0.1.0" --- ``` 1. **Filter:** Ingest only `status: final` sessions 2. **Group:** Cluster by `topic` tags 3. **Map:** Extract atomic Key Findings and Recommendation sections 4. **Reduce:** Merge topic clusters into unified subsystem chapters 5. **Reconcile:** Resolve cross-session contradictions using confidence + date weighting 6. **Trace:** Annotate all FAD blocks with originating session and ADR IDs 7. **Gate:** Subject to Track B Phase 0 Gate before committing #### 6.3.1 FAD Versioning and Post-Seal Updates Once sealed, a FAD is immutable. When a `review_trigger` fires or new evidence invalidates a locked ADR: 1. **Open a new research session** targeting the specific decision under review. 2. **Record a new ADR** (D-NNN+1) with `supersedes: D-NNN` linking to the original. 3. **Issue a FAD Amendment** (SYN-01.1, SYN-01.2, etc.) documenting only the changed sections with full traceability. 4. **Re-run the Phase 0 Gate** for the amended decision only. Do NOT modify the original sealed FAD. Amendments are additive documents that reference the sealed original. ### 6.4 Weighted Evaluation Protocol (Comparison Sessions) When a research session involves comparing multiple options (e.g., database selection, framework evaluation, vendor comparison), the qualitative analysis must be complemented by a **quantitative weighted scoring matrix** to counteract narrative volume bias — the systematic tendency of AI models to favor options with more training data, blog coverage, and community advocacy regardless of project-specific fit. #### Why This Matters Qualitative-only comparison is vulnerable to three documented biases: - **Narrative volume bias:** Technologies with larger communities produce more positive text, creating an illusion of superiority that reflects popularity, not fitness. - **Verbosity bias:** Models prefer longer, more detailed responses — well-documented options get richer analysis, which reads as stronger evidence. - **Vendor marketing contamination:** Well-funded products produce Grade C evidence (vendor claims) at scale, drowning out Grade A/B evidence for alternatives. Weighted scoring forces the model to evaluate each option against explicit, project-derived criteria rather than relying on narrative coherence. #### Protocol For any session that evaluates 2+ competing options: 1. **Derive Criteria from Project Context:** Extract 5–8 evaluation criteria directly from the project vision and the decision being informed. Do not use generic criteria — every criterion must trace to a specific project requirement or constraint. 2. **Assign Weights (must sum to 1.0):** Weight each criterion by its importance to this specific project. Justify each weight with a one-line rationale. Example: | Criterion | Weight | Rationale | |---|---|---| | Write throughput at scale | 0.25 | Core use case: high-volume event ingestion | | Operational complexity | 0.20 | Solo developer, no dedicated DevOps | | Query flexibility | 0.20 | Ad-hoc analytics required by product spec | | Ecosystem maturity | 0.15 | Long-term maintenance, not greenfield research | | Cost at projected scale | 0.10 | Bootstrap budget, cost-sensitive first 18 months | | Migration path | 0.10 | Two-way door if wrong, but migration still has cost | 3. **Score Each Option (1–5 scale):** Score every option against every criterion using this scale: - **5:** Exceptional fit, clear leader on this criterion (with evidence) - **4:** Strong fit, minor gaps - **3:** Adequate, meets minimum requirements - **2:** Weak, notable gaps or concerns - **1:** Poor fit, significant risk or missing capability Each score must reference the specific evidence (E-NNN or inline citation) that justifies it. Scores without evidence references are invalid. 4. **Compute Weighted Totals:** Multiply each score by its weight and sum across criteria. 5. **Sensitivity Check:** Identify the top 2 criteria by weight. Re-run the calculation with those weights shifted ±20%. If the ranking changes, flag the recommendation as **weight-sensitive** and note which criteria drive the instability. 6. **Synthesize:** The final recommendation must consider BOTH the weighted score AND the qualitative analysis. The score is a **bias-correction lens**, not the sole decision input. If qualitative analysis and scoring disagree, explicitly address the divergence and explain which signal the recommendation follows and why. #### Important Constraints - This protocol applies ONLY to comparison sessions. Landscape scans, single-technology deep dives, and blueprint sessions do not require scoring. - The weighted score is a complement to qualitative analysis, never a replacement. Architectural decisions involve judgment dimensions (team culture, strategic direction, ecosystem trajectory) that resist quantification. - Criteria selection itself can introduce bias. The model must justify WHY these criteria and not others. ## Phase 0 Exit Gate ### 7.1 The Two-Track Standard | Track | Applies To | Requirements | Speed | | --- | --- | --- | --- | | **Track A: Fast-Track** | Two-Way Door decisions | Decision logged, reversibility confirmed, single corroborated source | Minutes | | **Track B: Rigorous Gate** | One-Way Door decisions | Pre-codebase exit gate (Rules G1–G11) + Gary Klein Premortem | Hours–Days | ### 7.2 Track B: Pre-Codebase Exit Checklist (Rules G1–G11) 1. **DAG Closure (G1/G2)** — All planned dependency sessions terminated in `status: complete` 2. **Contradiction Resolution** — All divergences explicitly resolved 3. **Evidentiary Threshold (G6)** — ≥2 Grade A/B claims, each on a line with its URL, across the ADR and the sessions that inform it: the composite citation (§5.5), a bracketed grade tag such as `[A · single · fresh · direct · fetched](url)` or `[Grade A: url | fetched]`, or an evidence-ledger row whose Grade cell is A or B. Uncorroborated Grade C/D/E claims must not underpin irreversible pillars 4. **Verification Integrity (G7)** — of the claims G6 counts, ≥2 carry the verification label `fetched` or `human-provided` (`human`), read exactly from the tag's last field or the ledger row's Verification cell; `cached`, `secondhand`, `recalled`, `verified` and `unverified` do not count. Labels are as reported by the agent; Vivechak does not fetch or verify sources 5. **No Placeholders & Alternatives Documented (G8)** — Every ADR includes evaluated and rejected options with substantive tradeoffs and zero placeholder stubs 6. **Decay Triggers Assigned (G9)** — Every ADR contains explicit, measurable `review_trigger` 7. **Adversarial Red-Team Challenge (G10)** — One-Way Door decisions subjected to adversarial stress testing with cited challenge record (`D-NNN-R1.md`) before commitment 8. **Human Review (G11)** — Named Principal Architect signature on all One-Way Door ADRs (`human_reviewed: true` via `vck signoff`) 9. **FAD Sealed (G3)** — Founding Architecture Document compiled, committed, ready for scaffolding 10. **Decision Traceability & Locked Status (G4/G5)** — All referenced decisions have corresponding ADRs locked in accepted or superseded status 11. **Premortem Protocol** — Gary Klein prospective hindsight: *"Assume catastrophic failure in 12 months. What caused it?"* ## Generator Architecture The pipeline generator uses a **deterministic/AI hybrid** architecture that produces two documents: a unified pipeline containing the execution plan and copy-paste-ready research prompts, plus a separate decision registry that evolves during execution. See [GENERATOR-PROJECT.md](GENERATOR-PROJECT.md) for the working generator prompt. The long-term vision is a 5-layer code-based tool: | Layer | Function | Implementation | | --- | --- | --- | | **0: Input** | Collect project vision via open-ended description | AI — parameter extraction from natural language | | **1: Classification** | 6-archetype domain classifier + 8-dimension complexity scoring | Deterministic — rule-based decision tree | | **2: Skeleton** | Assemble session matrix from archetype templates + tier budget | Deterministic — template composition | | **3: Prompt Synthesis** | Generate project-specific prompt prose for each session slot | AI — N parallel scoped calls | | **4: Registry Seeding** | Generate project-specific D-NNN hypotheses | AI — scoped calls tied to vision + constraints | | **5: Validation** | Schema validation, archetype completeness, budget verification | Deterministic — CI-style gates | ### The 6 Domain Archetypes | Archetype | Unique Research Needs | | --- | --- | | **B2B SaaS** | Multi-tenancy, RBAC/SAML, CRM integrations, seat/usage pricing | | **Developer Tools** | DX & time-to-first-value, CLI/SDK idioms, open-source licensing | | **FinTech** | KYC/AML, banking rails, immutable ledgers, PCI-DSS, fraud detection | | **AI/ML Systems** | Model selection, eval benchmarks, inference cost, context architecture | | **Consumer Mobile** | App Store compliance, offline-first sync, push/retention, in-app billing | | **Real-Time / IoT** | MQTT/WebSockets, edge vs cloud compute, fleet OTA, hardware constraints | #### Beyond Software: Domain Adaptation Vivechak's epistemic core — evidence grading (Admiralty-Code-derived source grading with GRADE-inspired modifiers), ACH conflict resolution (CIA/Heuer), premortem protocol (Gary Klein), reversibility routing (Bezos Type 1/2 doors), and map-reduce synthesis — was not invented for software. These primitives govern how intelligence reasons about truth, risk, and irreversibility in *any* domain. The generator prompt already uses "technical project" rather than "software project." The 6 operational templates (Decisions, Conflict Resolution, Comparison Session, FAD, Phase 0 Gate, Session Note) contain zero software-specific content. Non-software domains have been successfully researched using adapted versions of the generator. **To adapt for a non-software domain:** 1. The 8 core principles, evidence grading, and all templates work without modification. 2. Add domain-specific archetypes to the generator (equivalent to the 6 software archetypes above). Each archetype defines the unique research needs for that domain. 3. Adapt the complexity scoring rubric labels — replace software-specific terms ("Standard CRUD," "New library") with domain-equivalent complexity indicators. 4. Adjust the APPROACH block's target audience — replace "Principal Architect" with the domain-equivalent decision-maker. #### Archetype Maintenance Archetypes are versioned data, not finished code. Domain research needs shift as technology and regulations evolve. Each archetype should be treated as a living reference: - Review archetypes after every 2–3 projects that use them. - If a project required significant ad-hoc adaptation beyond its assigned archetype, consider whether a new archetype is warranted. - If the generator's fallback path (projects that don't fit any archetype) triggers frequently, that's a signal a new archetype is needed — not evidence the fallback is working. ## Multi-Scope Research Vivechak operates at three scope levels. Scope and depth are **independent axes** — a comparison can be shallow or deep; a project can be Tier 0 or Tier 3. The scope level determines the entry point, output shape, and which methodology mechanisms apply; the depth determines how many sessions and how much evidence is required. ### 9.1 The Three Scope Levels | Scope | Entry Point | Sessions | Output | When to Use | | --- | --- | --- | --- | --- | | **Project** | `GENERATOR-PROJECT.md` | Tier-determined (1–30) | Full pipeline → FAD | New project, major pivot, or system-wide re-evaluation | | **Decision** | `GENERATOR-DECISION.md` | 1–3 (capped; escalate if more) | Research plan + proposed ADR | Single architectural decision, standalone or mid-project | | **Comparison** | `GENERATOR-COMPARISON.md` | 1 (always) | WEP comparison matrix | Bounded comparison of 2–5 named options | **Scope selection is the user's choice**, not an automatic classification. The generators include guards (SCOPE CHECK, ESCALATE) that flag when a chosen scope may be insufficient, but never block output. ### 9.2 Methodology Invariants (I1–I9) These rules hold at **every** scope level. They are the shared methodology kernel — the text that must stay byte-identical across all three generators. | # | Invariant | Source | How It Carries | | --- | --- | --- | --- | | **I1** | Bounded Exploration Mandate — stated scope is a coverage floor, not a ceiling | P4 | Verbatim instruction in APPROACH block | | **I2** | Evidence grading: A–E base + corroboration/recency/directness modifiers + verification method; recalled capped at Grade D | §5.1–5.4 | Verbatim grading legend in DELIVERABLE block | | **I3** | 8-block prompt anatomy: DECISION → BRIEF → SCOPE → KNOWN → CALIBRATION → APPROACH → DONE → FORMAT | §4.1 | Structural template in every emitted prompt | | **I4** | Audience framing, not persona assignment — quality bar, not role-play | P4 | BRIEF block: "a principal architect needing production-grade tradeoffs" | | **I5** | 7-section output skeleton; Recommendation isolated from Alternatives Considered | P6, §6.2 | FORMAT block | | **I6** | Weighted Evaluation Protocol (WEP) for any session comparing 2+ options | §6.4 | DELIVERABLE block in C-role and comparison prompts | | **I7** | Structured falsification: seek disconfirming evidence; premortem for one-way doors | P8 | APPROACH block + F-role sessions | | **I8** | Door-type test (Bezos one-way/two-way) | P2 | Classification step in decision generator; SCOPE CHECK in comparison generator | | **I9** | No drip-fed instructions — front-load the complete brief in one turn | P4 | All generators emit single, self-contained prompts | ### 9.3 Decision Routing (Decision Scope) At decision scope, the 8-dimension project complexity score is replaced by a 4-dimension **R/N/B/X profile** scored 0–3: | Dimension | 0 | 1 | 2 | 3 | | --- | --- | --- | --- | --- | | **R** Reversal cost (against current STAGE) | Flag flip | Module swap | Data/contract migration | Rewrite/external commitment | | **N** Novelty (higher of domain and technical) | Team standard | New to team | Unconventional/fast-moving | Unproven | | **B** Blast radius | One module | One subsystem | Several subsystems/dependent decisions | Whole product/external contracts | | **X** Regulatory | None | Internal data | PII/GDPR/SOC2 | HIPAA/PCI/KYC/children | **Classification:** One-way door if R≥2 or B=3. Novel if N≥2. Hard override: X=3 forces DEEP RESEARCH. **Routing matrix** (same 4 lanes as §3.2): | | Known (N<2) | Novel (N≥2) | | --- | --- | --- | | **Two-way** (R<2 and B<3) | SKIP — ADR skeleton + 1 optional prompt | FAST SPIKE — 1 session | | **One-way** (R≥2 or B=3) | CONFIRM & COMMIT — 1 session | DEEP RESEARCH — 2–3 sessions | **Session roles:** L (Landscape — maps the option space), C (Comparison — WEP evaluation), F (Falsify — premortem and failure analysis). Hard cap of 3 sessions; if more are needed, escalate to project scope. ### 9.4 Scope Boundaries and Guards | Guard | Location | Behavior | | --- | --- | --- | | **SCOPE CHECK** | Comparison generator | Detects one-way doors, sensitive data, yes/no framing, incomplete option lists. Adds "Use the decision-level generator" but still writes the comparison prompt. | | **ESCALATE** | Decision generator | Fires when >3 sessions would be needed or the context contains multiple coupled decisions. Outputs "ESCALATE: use the project-level generator" with the sub-decisions listed. | | **Adjacent decisions** | Decision generator | Lists up to 3 noticed adjacent decisions (one line each) rather than absorbing them into the current scope. | ### 9.5 What Changes Between Scopes Four project-level mechanisms are **correctly omitted** below project scope: 1. **8-dimension / 0–24 project complexity score and tier mapping** — replaced by R/N/B/X at decision scope; absent at comparison scope. 2. **6-archetype classifier** — meaningless for a single decision or comparison. 3. **DAG session-matrix construction** — a decision has at most 3 sessions in a simple dependency shape; a comparison has exactly 1. 4. **"Add sessions for concerns the user didn't mention"** — replaced by "list adjacent decisions, don't absorb them" at decision scope, and SCOPE CHECK redirect at comparison scope. ## Composition Strategy Replace fixed compose/build ratios with Wardley evolution mapping: | Evolution Stage | Strategy | Examples | | --- | --- | --- | | **Commodity/Utility** | 100% compose | Auth, DB, Storage, Queues, UI primitives | | **Product** | Evaluate compose vs customize | CMS, analytics, email, payments | | **Custom** | Extend/fork existing tools | Specialized dashboards, domain UI patterns | | **Genesis** | 100% custom build | Core algorithms, domain state machines, business logic | ## Specification Provenance This framework was produced by applying Vivechak to itself: - **11 independent research sessions** across frontier AI platforms - **31 evidence nodes** from peer-reviewed studies, industry standards, and empirical benchmarks - **10 hypothesis verdicts** — 0 fully validated as-is, 3 refuted, 5 refined, 2 validated with enhancements The complete evidence base is preserved in [docs/meta-research/](docs/meta-research/). The framework is fully self-contained without it. --- # Verified MCP Host Presets & Setup Guides > 1-command configuration and auto-detected setup paths across Cursor, Claude Code, VS Code, Google Antigravity, Windsurf, Zed, and Goose. ## Overview Configure Vivechak as an MCP server in your AI host. Vivechak is a **universal Model Context Protocol (MCP) server**. It communicates over standard `stdio` using JSON-RPC 2.0. Any IDE, agent CLI, or runtime that supports the open MCP standard can connect to Vivechak out of the box. > **Note:** **💡 Shorthand CLI Alias (`vck`):** Vivechak installs the official 3-letter shorthand **`vck`** alongside `vivechak`. Both names are 100% identical and interchangeable across all subcommands (`vck setup`, `vck mcp-config`, `vck version`, `vck doctor`, `vck gate`, `vck serve`). ## Quick Host Setup (`vck setup`) The fastest way to configure your AI host is the streamlined **`setup`** subcommand (aliased as `install`): ```markdown # Configure any supported desktop host or harness in 1 second: vck setup cursor # Cursor IDE vck setup vscode # VS Code (Copilot Agent mode) vck setup claude # Claude Desktop vck setup agy # Google Antigravity (IDE, 2.0, CLI) # Inside a project with an active host folder (.cursor, .agents, .vscode, .roo, etc.): vck setup # Auto-detects workspace host! # Target any custom JSON file or folder directly (folders auto-target /mcp.json): vck setup /path/to/mcp-settings.json vck setup /path/to/my-agent-folder # Preview changes without modifying files: vck setup cursor --dry-run ``` `vck setup` automatically resolves the target configuration file, detects whether global or workspace scope is active, formats Windows/macOS/Linux paths cleanly, and merges the Vivechak MCP server block without overwriting existing servers. ### Universal Agent Skill (`npx skills add`) For agent harnesses that support decentralized skills (Claude Code, Cursor, Antigravity, OpenCode), install Vivechak's skill directly: ```markdown npx skills add bhaskarjha-dev/vivechak ``` This automatically installs the calibrated agent playbook (`skills/vivechak/SKILL.md`) into your workspace or global skill catalog. ### Smithery CLI (`@smithery/cli`) If you use [Smithery.ai](https://smithery.ai) for automatic MCP client discovery and installation: ```markdown npx -y @smithery/cli install @bhaskarjha-dev/vivechak --client cursor # Or for Claude Desktop: npx -y @smithery/cli install @bhaskarjha-dev/vivechak --client claude ``` ### Native MCP Prompts & Slash Commands Once Vivechak is connected, typing `/` in compatible chat clients (Antigravity IDE, Cursor, Claude Desktop, Continue, Zed) reveals 4 native prompt templates (in Claude Code, they appear as `/mcp__vivechak__`): - **`/compare`:** Interactive brief for 2–5 option comparisons (~5 min, WEP matrix). - **`/decision`:** Interactive brief for resolving an architectural dilemma (~30 min, ADR). - **`/project`:** Interactive brief for decomposing a greenfield system into an adaptive DAG to a FAD. - **`/gate`:** Pre-codebase exit criteria evaluation checklist. ### Pre-Packaged Editor Rules Pre-configured rules are available in `templates/rules/`: - **Cursor:** `templates/rules/cursor.mdc` (copy to `.cursor/rules/vivechak.mdc`) - **Claude Code:** `templates/rules/claude.md` (copy to `.claude/rules/vivechak.md` or append to `CLAUDE.md`) - **Google Antigravity:** `templates/rules/antigravity.md` (copy to `.agents/rules/vivechak.md`) ## Universal Setup & Manual Configuration ### Universal MCP JSON (`vck mcp-config`) To generate the exact JSON snippet containing the absolute path of your current binary (for any host or agent that supports standard MCP), run: ```markdown vck mcp-config ``` Output: ```json { "mcpServers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"] } } } ``` #### Ephemeral Runners (Zero Local Binary Installation) If you prefer not to install the binary onto your system `$PATH`, configure any host to run Vivechak on the fly via `npx`, `uvx`, or Docker: **Via `npx` (Node.js):** ```json { "mcpServers": { "vivechak": { "command": "npx", "args": ["-y", "vivechak", "serve"] } } } ``` **Via `uvx` (Python):** ```json { "mcpServers": { "vivechak": { "command": "uvx", "args": ["vck", "serve"] } } } ``` **Via Docker (Containers / Cloud Agent Sandboxes)** — replace `:` with the output of `echo "$(id -u):$(id -g)"`: ```json { "mcpServers": { "vivechak": { "command": "docker", "args": ["run", "-i", "--rm", "--user", ":", "-e", "VIVECHAK_PROJECT_ROOT=/workspace", "-v", "${workspaceFolder}:/workspace", "ghcr.io/bhaskarjha-dev/vck:latest", "serve"] } } } ``` ### Supported Desktop Hosts & Harness Presets Each preset writes the file and key that the host's own documentation names (the documentation URL is next to each preset in `cmd/vivechak/presets.go`). | Environment / Harness | Fast Setup Command | Preset Shortcut | Default Config Location | Schema Key | | --- | --- | --- | --- | --- | | **Cursor** | `vck setup cursor` | `cursor` | `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (workspace) | `mcpServers` | | **VS Code** | `vck setup vscode` | `vscode` | `.vscode/mcp.json` (workspace; legacy file, see [VS Code](#vs-code)) | `servers` | | **Claude Desktop** | `vck setup claude` | `claude`, `claude-desktop` | `claude_desktop_config.json` (OS-specific application storage) | `mcpServers` | | **Claude Code** | `vck setup claude-code` | `claude-code`, `claudecode` | `~/.claude.json` (global) or `.mcp.json` (workspace) | `mcpServers` | | **OpenCode** | `vck setup opencode` | `opencode`, `open-code` | `opencode.json` or `.opencode/opencode.json` (workspace), or `~/.config/opencode/opencode.json` | `mcp` | | **Block Goose** | `vck setup goose` | `goose`, `block-goose` | `~/.config/goose/config.yaml` (or `%APPDATA%\Block\goose\config\config.yaml`) | `extensions` | | **Windsurf** | `vck setup windsurf` | `windsurf` | `~/.codeium/windsurf/mcp_config.json` (discovery file, see [Windsurf](#windsurf)) | `mcpServers` | | **Google Antigravity** | `vck setup agy` | `agy`, `antigravity` | `~/.gemini/config/mcp_config.json` (global) or `.agents/mcp_config.json` (workspace) | `mcpServers` | | **Zed Editor** | `vck setup zed` | `zed` | `~/.config/zed/settings.json` (or `%APPDATA%\Zed\settings.json`) | `context_servers` | | **Roo Code (VS Code)** | `vck setup roo` | `roo` | `.roo/mcp.json` (workspace) | `mcpServers` | **Hosts without a preset** (for example Cline, Kiro, Continue, Trae, GitHub Copilot CLI, OpenHands, Factory Droid, Devin): find the MCP config file in the host's own documentation and run `vck setup `; Vivechak merges its entry into that file under the `mcpServers` key (or the key the file already uses). *(The legacy syntax `vck mcp-config --preset --write` and `vck mcp-config --path --write` remains 100% backward-compatible for scripts and automation).* > **Note:** **Protocol Neutrality Note:** These presets are strictly convenience shortcuts for filesystem path resolution across macOS, Windows, and Linux. At runtime, every MCP harness and editor interacts with Vivechak through the exact same JSON-RPC 2.0 wire protocol over `stdio`. ## Desktop IDE Quick Reference The following subsections document the default locations and shortcut commands for desktop editors: ### Cursor #### Automatic ```markdown vck setup cursor # or: vivechak mcp-config --preset cursor --write ``` #### Manual Edit `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your workspace): ```json { "mcpServers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"], "env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" } } } } ``` > **Note:** **Automatic Workspace Injection:** Running `vck setup cursor` automatically configures `"env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" }`, ensuring Cursor dynamically resolves your active workspace root without manual configuration. | OS | Config Path | | --- | --- | | macOS | `~/.cursor/mcp.json` | | Linux | `~/.cursor/mcp.json` | | Windows | `%USERPROFILE%\.cursor\mcp.json` | ### VS Code Native VS Code (via GitHub Copilot Agent mode) discovers MCP servers defined in your project's `.vscode/mcp.json`. Note that **native VS Code uses the `"servers"` key** rather than `"mcpServers"`. > **Note:** **Legacy file:** `vck setup vscode` writes `.vscode/mcp.json`, which VS Code's [MCP configuration reference](https://code.visualstudio.com/docs/copilot/reference/mcp-configuration) documents as deprecated (the Local harness that reads it is to be removed in February 2027). VS Code's native Copilot files are `~/.copilot/mcp-config.json` and a workspace-root `.mcp.json`, both with the `mcpServers` key; write them with `vck setup `. #### Automatic ```markdown vck setup vscode # or: vivechak mcp-config --preset vscode --write ``` #### Manual Edit `.vscode/mcp.json` in your workspace root: ```json { "servers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"], "env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" } } } } ``` > **Note:** **Automatic Workspace Injection:** Running `vck setup vscode` automatically injects `"env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" }`, ensuring VS Code expands the macro to your active workspace folder. > **Note:** **Note for Extension Users (Cline, Roo Code, Continue):** If you use VS Code extensions like Cline or Roo Code, they use the generic `"mcpServers"` format in their extension settings tabs. You can paste the output of `vck mcp-config` directly into their MCP settings panel. ### Claude Desktop #### Automatic ```markdown vck setup claude # or: vivechak mcp-config --preset claude-desktop --write ``` #### Manual Edit `claude_desktop_config.json`: ```json { "mcpServers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"] } } } ``` | OS | Config Path | | --- | --- | | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` | | Windows | `%APPDATA%\Claude\claude_desktop_config.json` | | Linux | `~/.config/Claude/claude_desktop_config.json` | > **Note:** **⚠️ macOS Note:** Claude Desktop runs as a GUI application with a truncated `$PATH` (`/usr/bin:/bin:/usr/sbin:/sbin`). The `command` field **must** use an absolute path to the Vivechak binary. Running `vck setup claude` handles this automatically. ### Windsurf #### Automatic ```markdown vck setup windsurf # or: vivechak mcp-config --preset windsurf --write ``` > **Note:** **Discovery file:** `vck setup windsurf` writes `~/.codeium/windsurf/mcp_config.json`. Per the [Windsurf (Devin) MCP docs](https://docs.devin.ai/windsurf/plugins/cascade/mcp), the editor reads that file only when its `chat.mcp.discovery.enabled` setting includes the `windsurf` source; Cascade's own MCP file is now `~/.config/devin/mcp_config.json` (Windows: `%AppData%\devin\mcp_config.json`), which you can write with `vck setup `. #### Manual Edit `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"], "env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" } } } } ``` > **Note:** **Automatic Workspace Injection:** Running `vck setup windsurf` automatically injects `"env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" }`. | OS | Config Path | | --- | --- | | macOS | `~/.codeium/windsurf/mcp_config.json` | | Linux | `~/.codeium/windsurf/mcp_config.json` | | Windows | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | > **Note:** **Tip:** After editing the configuration, click the **Refresh** button in Windsurf's Cascade MCP panel to load the server. ### Google Antigravity (Antigravity IDE, Antigravity 2.0, & Antigravity CLI `agy`) Antigravity discovers MCP servers via **`mcp_config.json`**. This single configuration is shared seamlessly across all Antigravity surfaces: - **Antigravity IDE** : Standalone in-editor AI pair programmer (VS Code-based). - **Antigravity 2.0** : The desktop application (chat canvas, agent orchestrator). - **Antigravity CLI (`agy`)** : The lightweight terminal interface / TUI. #### Automatic Setup Run either shortcut (both `vck setup agy` and `vck setup antigravity` are supported): ```markdown vck setup agy # or: vivechak mcp-config --preset antigravity --write ``` *Writes to `~/.gemini/config/mcp_config.json` (global, available across all projects and CLI sessions) or `.agents/mcp_config.json` if run inside a project with an `.agents/` directory.* #### Antigravity CLI (`agy`) Native Command You can also register Vivechak directly via the `agy` CLI command: ```markdown agy mcp add vivechak /path/to/vivechak ``` *(Or inspect configured servers in `agy` via `agy mcp list`, or press `/mcp` inside the interactive TUI).* #### Manual JSON Configuration Add Vivechak to `~/.gemini/config/mcp_config.json` (global) or `/.agents/mcp_config.json` (workspace): ```json { "mcpServers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"] } } } ``` | Scope | Location | Applies To | | --- | --- | --- | | **Global** | `~/.gemini/config/mcp_config.json` | All Antigravity surfaces (IDE, 2.0, CLI `agy`) across all projects | | **Workspace** | `.agents/mcp_config.json` | Project-specific workspace | > **Note:** **Tip:** In Antigravity IDE or Antigravity 2.0, you can verify active MCP servers anytime in the chat panel via **"..." (More Options) > "Manage MCP Servers" > "View raw config"**. Inside the `agy` terminal, use `/mcp` or `agy mcp list`. **Workspace Location Best Practice:** When prompting agents in IDE environments, ensure agents pass `project_root` explicitly if needed (or configure `"env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" }` or `"VIVECHAK_PROJECT_ROOT"`). Vivechak includes active guards against host CWD inheritance and rejects any attempts to initialize workspaces inside application program folders (`AppData\Local\Programs\...`). ### Zed Editor Zed supports MCP natively via its Assistant panel and sandboxes MCP servers. Zed uses the **`"context_servers"`** configuration key. #### Automatic ```markdown vck setup zed # or: vivechak mcp-config --preset zed --write ``` #### Manual Edit `settings.json` (accessible via Command Palette: `zed: open settings`): ```json { "context_servers": { "vivechak": { "command": "/usr/local/bin/vivechak", "args": ["serve"] } } } ``` | OS | Config Path | | --- | --- | | macOS | `~/.config/zed/settings.json` | | Linux | `~/.config/zed/settings.json` | | Windows | `%APPDATA%\Zed\settings.json` | ### Roo Code (VS Code Extension) Roo Code reads project-level MCP servers from `.roo/mcp.json` in your project root: ```markdown vck setup roo # or: vivechak mcp-config --preset roo --write ``` *Writes `.roo/mcp.json` in the current directory. Roo Code's global `mcp_settings.json` is opened from its MCP settings view; to write it, run `vck setup `.* ### Other Hosts (No Preset) Cline, AWS Kiro, ByteDance Trae, Oh My Pi, OpenHands, Factory Droid, Cognition Devin, Continue.dev, Void and GitHub Copilot CLI have no `vck setup` preset, because their config locations were not verified against their own documentation. Find the MCP config file in the host's documentation and run: ```markdown vck setup # or: vivechak mcp-config --path --write ``` Hosts with their own MCP command can also register Vivechak directly (see [CLI-Native Agent Harnesses](#cli-native-agent-harnesses)). ### Claude Code Claude Code supports user-global settings in `~/.claude.json` as well as project-level `.mcp.json`. `vck setup` automatically merges the Vivechak MCP server while strictly preserving user state, tokens, and active sessions: ```markdown vck setup claude-code ``` ### OpenCode OpenCode terminal agent uses `opencode.json` with the specialized `"mcp"` key and array-style execution commands: ```markdown vck setup opencode ``` ### Block Goose Block Goose orchestrates stdio extensions via YAML in `~/.config/goose/config.yaml`. `vck setup` safely merges the extension into Goose's configuration without disturbing existing settings: ```markdown vck setup goose ``` ### CLI-Native Agent Harnesses For terminal agents with built-in MCP management commands, you can register Vivechak directly without manually touching configuration files: - **Claude Code** : ```sh claude mcp add vivechak -- /path/to/vivechak serve ``` - **xAI Grok Build** : ```sh grok mcp add vivechak -- /path/to/vivechak serve ``` - **GitHub Copilot CLI** : ```sh copilot mcp add vivechak /path/to/vivechak serve ``` - **Block Goose** : ```sh goose configure # Select stdio -> name: vivechak -> command: /path/to/vivechak -> args: serve ``` - **Sourcegraph Amp** : ```sh amp mcp add vivechak /path/to/vivechak ``` ## Graphical & Interactive Settings For clients or applications that configure MCP servers through an interactive settings interface (such as desktop AI apps or custom agent dashboards), add the server directly via their configuration panel: - **Name:** `vivechak` - **Command:** Absolute path to `vivechak` (run `vck mcp-config` to output the exact binary path) - **Arguments:** `serve` - **Transport:** `stdio` ## Windows Configuration On Windows, use escaped backslashes (`\\`) in configuration files: ```json { "mcpServers": { "vivechak": { "command": "C:\\Users\\you\\AppData\\Local\\Programs\\vivechak\\vivechak.exe", "args": ["serve"] } } } ``` The `vck setup` (and `vck mcp-config --write`) command automatically detects and formats Windows paths correctly. ## Troubleshooting & Diagnostics ### Binary Not Found Make sure the `command` field uses an **absolute path**. GUI applications on macOS do not inherit terminal `$PATH`. ### Verify Installation & Workspace ```markdown vck version vck doctor /path/to/your/project vck gate /path/to/your/project ``` ### Test MCP Connection Interactively Verify that the Vivechak MCP server responds over stdio using the official MCP Inspector: ```markdown npx @modelcontextprotocol/inspector vck serve ``` --- # Zero-Install Manual Workflow > Use Vivechak in browser deep-research chats (ChatGPT, Claude.ai, Gemini, Perplexity) with zero local installations and 100% template fidelity. ## Overview ### Complete Guide to Evidence-Grounded Research Without an MCP Server > **Note:** **Audience:** Developers and technical architects who want to use Vivechak by copying and pasting prompts into web-based AI interfaces (ChatGPT Deep Research, Gemini Deep Research, Claude 3.7 Sonnet with Search, Perplexity Pro) without running the MCP server or CLI tooling. ## Overview Vivechak is an evidence-grounded research meta-framework. While it ships with a Model Context Protocol (MCP) server for automated agent integration, **the methodology itself is entirely interface-agnostic**. You can execute the full research pipeline by hand using web browser AI chats, your favorite text editor, and standard Markdown files. Whether executed through an automated agent or manually through copy-paste: - Every factual claim requires an **Evidence Grade (A–E)** with verification metadata. - Every architectural decision is classified as a **One-Way Door** (irreversible) or **Two-Way Door** (reversible). - Research sessions are structured with standard **8-Block Prompts** (`DECISION`, `BRIEF`, `SCOPE`, `KNOWN`, `CALIBRATION`, `APPROACH`, `DONE`, `FORMAT`). - Decisions are locked only after satisfying formal **Phase 0 Exit Gates**. ### Manual Workflow vs. MCP Server | Step | Manual Workflow (This Guide) | MCP Server (`vivechak serve`) | | --- | --- | --- | | **Pipeline Generation** | Copy generator prompt into AI web chat; paste vision | Agent calls `vivechak_start` or reads generator directly | | **Workspace Setup** | Manually create folders and copy templates from repo | Agent calls `vivechak_start` to scaffold the workspace; templates are served as MCP resources | | **Prompt Delivery** | Copy fenced ```` ```prompt ```` blocks into fresh AI chats | Agent calls `vivechak_next` to retrieve next unblocked prompt | | **Session Saving** | Copy AI chat response, save to `research/sessions/*.md` | Agent calls `vivechak_save` to validate and persist artifact | | **Decision Registry** | Update `research/DECISIONS.md` using template format | Agent calls `vivechak_record_decision` to validate schema and append | | **Gate Verification** | Audit checklist in `research/templates/PHASE-0-GATE.template.md` | Agent calls `vivechak_gate` or CLI `vck gate` to verify DAG & evidence | ## The Three Scope Levels Choose the entry point that matches the size and blast radius of your decision space: ```markdown flowchart TD Start["What are you researching?"] --> Choice{"Scope of decision"} Choice -->|"Entire new system or major architectural overhaul"| P["1. Project Scope
GENERATOR-PROJECT.md
(4–30 sessions → FAD)"] Choice -->|"Single architectural fork with trade-offs"| D["2. Decision Scope
GENERATOR-DECISION.md
(1–3 sessions → ADR)"] Choice -->|"Bounded selection between 2–5 named tools/libraries"| C["3. Comparison Scope
GENERATOR-COMPARISON.md
(1 session → WEP Matrix)"] ``` > **Note:** **When NOT to use Vivechak:** Do NOT use Vivechak prompts for direct code implementation, debugging errors, syntax lookups, or local refactoring. Vivechak is an epistemic research framework for technical choices and architectural evaluations; for writing code, prompt your AI model directly without research templates. ## Project Scope (Full Pipeline Workflow) Use this workflow when designing a new product, platform, or large-scale subsystem. The pipeline scales dynamically (Tier 0 to Tier 3) and produces a complete **Founding Architecture Document (FAD)** backed by locked **Architectural Decision Records (ADRs)**. ### Step 1: Get the Generator Prompt 1. Open [`GENERATOR-PROJECT.md`](../GENERATOR-PROJECT.md) in your editor or browser. 2. Locate the prompt inside the outer Markdown code fence (starting at `# GENERATE: Research Pipeline for a Technical Project` and ending before the closing fence and `## Set Up Your Project`). 3. Copy the entire contents of that prompt. ### Step 2: Fill in the `PROJECT VISION` Section Inside the copied text, locate the `## PROJECT VISION` block: ```markdown ## PROJECT VISION [PASTE YOUR PROJECT DESCRIPTION HERE] ``` Replace `[PASTE YOUR PROJECT DESCRIPTION HERE]` with an open-ended, natural-language brain dump of your project. Write everything you know—and everything you don't know: - **What and Why:** Core user problems, value proposition, operational model. - **Audience & Scale:** Target users, expected concurrency, initial vs. 3-year data volume. - **Known Constraints:** Budget, deployment model (cloud/on-prem), geography, regulatory exposure (GDPR, HIPAA, PCI, SOC2). - **Technical Opinions:** Preferred languages, frameworks, or cloud providers you strongly lean towards. - **Uncertainties:** Anything you are actively wondering about (e.g., datastore selection, state sync, queuing, caching). #### Concrete Example: ```markdown ## PROJECT VISION We are building LogMesh, an edge-native log aggregation and anomaly detection platform for distributed Kubernetes clusters running across multiple cloud providers and on-prem bare metal. Target Users: DevOps and platform engineering teams managing 50–500 microservices across multi-region clusters. Workload: Ingesting 20,000–100,000 events/sec per cluster at peak. We need sub-second query latency for real-time alerting, but must retain compressed cold logs for 90 days. Constraints: - Customers will include FinTech and healthcare startups: strict tenant isolation, GDPR and SOC2 compliance are required from day one. Log payloads may contain PII. - Must run as a self-hosted Helm chart or lightweight daemonset on edge clusters, with an optional managed central SaaS dashboard. - Modest infrastructure budget for customers: low memory footprint (<256MB RAM per edge node). Strong Opinions: - Edge collector written in Go or Rust for low memory footprint and static binaries. - Central dashboard in Next.js / TypeScript. Uncertainties: - Central analytical datastore: ClickHouse vs. VictoriaLogs vs. OpenSearch vs. DuckDB. - Transport and streaming: NATS JetStream vs. Apache Kafka vs. Vector pipeline. - Anomaly detection architecture: In-stream WASM filters vs. central periodic batch models. ``` ### Step 3: Send to AI and Extract the Deliverables 1. Open a fresh browser chat with a frontier AI model (**Claude 3.7 Sonnet**, **ChatGPT o3/4o with Web Search**, or **Gemini 2.5 Pro**). 2. Paste the generator prompt containing your filled vision. 3. Submit the prompt. The AI will output two distinct deliverables: 1. `RESEARCH-PIPELINE.md`: Contains its `yaml vivechak-plan` block (every session once with its dependencies, and the one `kind: synthesis` session; the only part `vck` and the MCP server read), project archetype extraction, 8-dimension complexity score (0–24), execution DAG (Layer 0 through Sink), and copy-paste-ready research prompts for each session under `## Sessions`. 2. `DECISIONS.md`: The initial decision registry seeded with proposed hypotheses (`D-001`, `D-002`, etc.) in YAML frontmatter format. > **Tip:** **Saving the files:** If the AI delivers them as downloadable Markdown artifacts, download both. If output as inline chat text, copy each document starting from its respective title down to the end of its section, and save them locally. ### Step 4: Set Up the `research/` Directory In your project repository root, create the `research/` directory structure and copy the 6 operational templates from the Vivechak repository: ```markdown my-project/ └── research/ ├── RESEARCH-PIPELINE.md ← Generated file from Step 3 ├── DECISIONS.md ← Generated file from Step 3 ├── sessions/ ← Create this empty directory for session notes └── templates/ ← Copy these 6 templates from vivechak/templates/ ├── COMPARISON-SESSION.template.md ├── CONFLICT-RESOLUTION.template.md ├── DECISIONS.template.md ├── FOUNDING-ARCHITECTURE.template.md ├── PHASE-0-GATE.template.md └── SESSION.template.md ``` #### Why Copy Templates Locally? These templates act as strict operational schemas. Having them inside `research/templates/` makes your repository **100% self-contained**. Any collaborator or AI coding agent can run sessions, resolve conflicts, and run gates without needing access to the upstream Vivechak repo. ### Step 5: Execute Research Sessions Open `research/RESEARCH-PIPELINE.md`. Review the **Execution DAG** and begin with **Layer 0** sessions. ```markdown ┌─────────────────────────┐ │ Layer 0: Landscape │ │ T1-01, T1-02 (Parallel) │ └───────────┬─────────────┘ │ ┌───────────▼─────────────┐ │ Layer 1: Decisions │ │ T2-01, T2-02 (Informed) │ └───────────┬─────────────┘ │ ┌───────────▼─────────────┐ │ Sink: Grand Synthesis │ │ SYN-01 (FAD Blueprint) │ └─────────────────────────┘ ``` #### Execution Protocol for Each Session: 1. **Find the Prompt:** In `RESEARCH-PIPELINE.md`, find the session entry under `## Sessions` (e.g., `### T1-01: Analytical Datastore Landscape`). Look for the prompt enclosed in ```` ```prompt ```` code fences. 2. **Open a FRESH AI Chat:** Never reuse an existing chat thread. Always start a fresh session to eliminate context drift, hallucination accumulation, and confirmation bias. 3. **Enable Deep Research / Web Search:** Ensure your model has active web browsing or deep research capabilities enabled (e.g., Gemini Deep Research, ChatGPT Deep Research, or Claude with Search). 4. **Copy & Paste:** Copy the exact text inside the ```` ```prompt ```` fence and paste it into the fresh chat. Send it. 5. **Inspect the Output:** - Verify that factual claims include evidence grades (e.g., `(Grade A · corroborated · fresh | fetched)`). - Check that recommendations are separated from rejected alternatives. - Confirm that the top contenders include concrete failure modes and disconfirming evidence. 6. **Save the Artifact:** Copy the full Markdown response and save it directly into `research/sessions/` using the exact filename specified in the session metadata table (e.g., `research/sessions/T1-01-analytical-datastore-landscape.md`). > **Note:** **Respecting Dependencies:** Each session's entry in the plan block lists the sessions it waits for (`depends:`). Layer 0 sessions are completely unblocked and run in parallel. Layer 1 sessions may depend on Layer 0. If a session specifies `Context: T1-01 (selected datastore)`, copy the 1-2 sentence recommendation from `research/sessions/T1-01-...md` and paste it into the context slot of the downstream prompt. ### Step 6: Record Decisions As research sessions finish, translate their findings into firm architectural decisions in `research/DECISIONS.md`. 1. Open `research/DECISIONS.md` and find the decision record corresponding to the completed session (e.g., `D-001: Analytical Datastore Selection`). 2. Update the YAML frontmatter: - Change `status: proposed` to `status: accepted` (or `rejected`). - Fill in `confidence: high | medium | low`. - Add references to evidence citations in `evidence_refs: [E-001, E-004]`. - Ensure `informed_by_sessions: [T1-01, T2-01]` reflects all relevant sessions. - Set a measurable `review_trigger` (e.g., `"Ingestion volume exceeds 150k events/sec or storage costs exceed $2,500/month"`). - Set `review_date` (e.g., 6 months from today). - If `door_type: one-way`, set `human_reviewed: true` only after a human principal architect reviews the rationale. 3. Fill the body sections according to [`templates/DECISIONS.template.md`](../templates/DECISIONS.template.md): - **Context & Problem Statement** - **Evaluated Options** (with inline evidence grades) - **Decision Outcome & Causal Rationale** - **Rejected Alternatives & Tradeoffs** - **Failure Modes & Reversal Triggers** #### Concrete ADR Example: ```markdown --- id: D-001 title: "Analytical Datastore: ClickHouse vs. VictoriaLogs" status: accepted door_type: one-way date: 2026-09-27 confidence: high evidence_refs: [E-101, E-104, E-108] informed_by_sessions: [T1-01] supersedes: null superseded_by: null amends: null review_trigger: "Edge log retention requirements exceed 180 days or memory per edge container exceeds 350MB" review_date: 2027-03-27 prediction: "ClickHouse handles 100k events/sec at <150MB RAM on edge with zstd compression ratio > 8x" tags: [storage, logs, edge] authored_by: "Principal Architect" human_reviewed: true schema_version: "0.1.0" --- # D-001: Analytical Datastore: ClickHouse vs. VictoriaLogs ## Context & Problem Statement LogMesh requires an embedded or lightweight daemonset datastore capable of ingesting 50k–100k events/sec with sub-second analytical queries over a 7-day rolling window on edge nodes. ## Evaluated Options 1. **ClickHouse (Embedded / Single Binary)** — Evidence: E-101 (Grade A · official docs | fetched) 2. **VictoriaLogs** — Evidence: E-104 (Grade B · empirical benchmarks | fetched) 3. **OpenSearch** — Evidence: E-108 (Grade A · official docs | fetched) ## Decision Outcome **Chosen Option:** ClickHouse (single binary / embedded mode). ### Rationale ClickHouse provides column-oriented vector execution with demonstrated 10x–14x zstd compression on structured JSON logs (E-101). VictoriaLogs has a smaller binary size but lacks multi-column secondary indexing needed for high-cardinality regex filtering on Kubernetes pod namespaces. ## Rejected Alternatives & Tradeoffs - **OpenSearch:** Rejected due to excessive JVM memory footprint (>2GB heap required), violating our strict edge memory constraint of <256MB RAM per node (E-108). - **VictoriaLogs:** Rejected because custom log queries require pipeline transformation syntax unfamiliar to SQL-native DevOps teams, increasing customer adoption friction. ## Failure Modes & Reversal Triggers - If memory consumption under burst ingestion exceeds 300MB RAM for >10 minutes, trigger evaluation of VictoriaLogs or out-of-process central shipping. - Scheduled review date: 2027-03-27. ``` ### Step 7: Handling Conflicts When two research sessions produce contradictory findings—or when you run the same session across two different models (e.g., Claude recommends Kafka, but ChatGPT Deep Research recommends NATS JetStream): 1. Do not average the results or pick your favorite. 2. Create a new file in `research/sessions/` named `CHK-01-[decision-name]-conflict.md` using [`templates/CONFLICT-RESOLUTION.template.md`](../templates/CONFLICT-RESOLUTION.template.md). 3. **Build the Analysis of Competing Hypotheses (ACH) Matrix:** - Place hypotheses as **rows** (Option A, Option B). - Place evidence items as **columns** ($E_1, E_2, E_3$). - Rate each cell: - `CC`: Consistent and Confirmatory - `C`: Consistent but not diagnostic - `N`: Neutral - `I`: Inconsistent (disconfirming) - `II`: Strongly Inconsistent 4. **Evaluate Inconsistencies:** The hypothesis with the **fewest inconsistencies** wins. 5. If the decision is a **One-Way Door**, run a 30-minute **Gary Klein Premortem**: > *"Assume it is 12 months from now and this decision caused a catastrophic production outage. What caused it?"* 6. Document the resolution and update the corresponding ADR in `research/DECISIONS.md`. ### Step 8: Synthesis (Compiling the FAD) Once all research sessions are complete and all decisions in `research/DECISIONS.md` are locked: 1. Create `research/FAD.md` (or in project root `FAD.md`) using [`templates/FOUNDING-ARCHITECTURE.template.md`](../templates/FOUNDING-ARCHITECTURE.template.md). 2. **Execute Map-Reduce Synthesis:** - **Filter & Group:** Group sessions by architectural domain (Persistence, Transport, Edge Runtime, UI). - **Map:** Extract key findings and locked ADR decisions. - **Reduce:** Write unified architectural chapters. 3. Fill out the required sections: - **1. Executive Summary:** 2–5 paragraph technical synthesis readable by stakeholders. - **2. Locked Decision Registry:** Summary table of all D-NNN decisions with evidence citations. - **3. Architecture & Primitives (Wardley Mapping):** Clearly distinguish between **Composed** (commodity off-the-shelf: ClickHouse, NATS, Next.js) and **Built** (custom proprietary IP: edge filter engine, anomaly heuristic engine). - **4. System Architecture Diagram:** A complete Mermaid diagram showing data flow and network boundaries. - **5. Cross-Cutting Concerns:** Security, compliance (GDPR/SOC2), and observability. - **6. Risk Register & Reversal Triggers:** Consolidated risks with measurable triggers. - **7. Project Structure Specification:** Directory tree, module boundaries, and dependency manifests. - **8. Traceability Matrix:** Mapping each FAD section back to session IDs and evidence IDs. 4. Set frontmatter `status: sealed`. ### Step 9: Running the Phase 0 Exit Gate Before writing a single line of application code, conduct the Phase 0 Gate audit using [`templates/PHASE-0-GATE.template.md`](../templates/PHASE-0-GATE.template.md). Create `research/PHASE-0-GATE.md` and audit every decision: ```markdown flowchart TD D[Evaluate Decision] --> Check{Door Type?} Check -->|Two-Way Door| TrackA[Track A: Fast-Track Gate] Check -->|One-Way Door| TrackB[Track B: Rigorous Gate (Rules G1–G11)] TrackA --> PassA{Reversible & Corroborated?} PassA -->|Yes| GatePass[Gate PASS] PassA -->|No| FixA[Fix ADR] TrackB --> PassB{G1–G11 Satisfied?} PassB -->|Yes| GatePass PassB -->|No| FixB[Resolve Blockers] ``` #### Track A: Fast-Track Gate (Two-Way Doors) Check two-way door conditions (Rule G12): - [x] Logged in ADR with `door_type: two-way`. - [x] Reversibility confirmed (can be swapped without major refactoring). - [x] At least one corroborated source supports the choice. #### Track B: Canonical Gate Rules (G1–G12) Evaluates mechanical structural integrity and rigor across both doors: - **G1. DAG Topology:** Project pipeline DAG is structurally valid with exactly one `kind: synthesis` session. - **G2. Session Completion:** All planned sessions completed with validated empirical findings. - **G3. FAD Completeness:** Founding Architecture Document (`FAD.md`) is complete and covers all accepted ADRs. - **G4. Decision Registration:** All referenced decisions have corresponding ADRs. - **G5. Target Resolution:** All target ADRs are accepted or resolved. - **G6. Evidentiary Threshold:** One-Way Door decisions have >=2 Grade A/B claims, each on a line with its URL, in the ADR or its informing sessions: a tag that starts with the grade (`[A · single · fresh · direct · fetched](url)`, `[Grade A: url | fetched]`, `(Grade A · corroborated · fresh | fetched)`) or an evidence-ledger row whose Grade cell is `A` or `B`. - **G7. Verification Provenance:** Of those claims, >=2 carry the label `fetched` or `human`/`human-provided`, read exactly from the tag's last field or the ledger row's Verification cell (`cached`, `recalled`, `verified` and `unverified` do not count; labels as reported, sources not fetched or verified). - **G8. No Placeholders & Alternatives:** One-Way Door ADRs contain no unexpanded placeholders or default template text, with substantive rejected alternatives. - **G9. Reversal Trigger:** One-Way Door ADRs have specific, measurable reversal triggers. - **G10. Adversarial Red-Team Challenge:** One-Way Door decisions have current, cited adversarial challenge records (`D-NNN-R1.md`) with matching outcome hashes. - **G11. Human Architect Sign-off:** All One-Way Door decisions have verified human sign-off (`human_reviewed: true` via `vck signoff`). - **G12. Fast-Track Exit:** Two-Way Door decisions meet fast-track exit criteria. ### Step 10: What "Passing the Gate" Means When `research/PHASE-0-GATE.md` records an overall **PASS**: 1. **Phase 0 (Research & Architecture) is officially closed.** 2. Commit all artifacts to your git repository (`git add research/ FAD.md && git commit -m "docs: seal Phase 0 research and architecture"`). 3. **Start Coding:** Proceed to repository scaffolding, CI/CD pipeline setup, and feature development in Phase 1. 4. Your `FAD.md` serves as the invariant specification. If an implementation hurdle arises that contradicts the FAD, you do not silently hack around it; you review the decision's reversal trigger and update the ADR. ## Decision Scope (Single Decision Workflow) Use this workflow when you face a single, high-stakes architectural fork in an ongoing project (e.g., *"Should we migrate from REST to gRPC for internal service communications?"*). ### Step 1: Open `GENERATOR-DECISION.md` Open [`GENERATOR-DECISION.md`](../GENERATOR-DECISION.md) and copy the generator prompt into a fresh AI web chat. ### Step 2: Fill the Context Block Populate the ```` ```context ```` block with your decision details: ```markdown DECISION: Should we use Apache Kafka or NATS JetStream for our telemetry ingest pipeline? OPTIONS: Apache Kafka, NATS JetStream, AWS Kinesis CONTEXT: Go-based microservices architecture; 40,000 telemetry msgs/sec; deployed on EKS; small 4-person platform team with zero Kafka operational experience. STAGE: pre-build LEANING: NATS JetStream, because of lower operational overhead and native Go integration. DATE: 2026-09-27 IDS: D-104, S-TELEMETRY ``` ### Step 3: Receive Output The AI will return two ready-to-use files: 1. `D-104-PLAN.md`: Its `yaml vivechak-plan` block (the sessions and what each waits for), decision profile (Reversibility, Novelty, Blast Radius, Regulatory Exposure), Door classification, and 1 to 3 session prompts (`L` Landscape, `C` Comparison, and `F` Falsification/Premortem) under `## Sessions`. 2. `D-104-telemetry-queue.md`: The proposed ADR skeleton with YAML frontmatter. ### Step 4: Execute Sessions and Lock ADR 1. Run each session prompt in a fresh browser chat with web search enabled. 2. Save session outputs to `research/sessions/D-104-S1-...md`. 3. Update `D-104-telemetry-queue.md` with the winning option, causal trade-offs, evidence grades, and reversal triggers. 4. If classified as a One-Way Door, require human review before marking `status: accepted`. ## Comparison Scope (Bounded Options Workflow) Use this workflow for a focused evaluation between 2 to 5 named tools, libraries, or vendors with known criteria (e.g., comparing CSS frameworks, test runners, or auth providers). ### Step 1: Open `GENERATOR-COMPARISON.md` Open [`GENERATOR-COMPARISON.md`](../GENERATOR-COMPARISON.md) and copy the text into an AI chat. ### Step 2: Fill the Context Block ```markdown OPTIONS: Vitest, Jest, Node Native Test Runner CRITERIA: ESM compatibility, TypeScript execution speed, watch mode performance, CI memory footprint CONTEXT: Next.js 15 monorepo; 1,200 unit tests; migrating away from legacy Babel setup. DATE: 2026-09-27 ID: D-TEST-RUNNER ``` ### Step 3: Execute the Generated Research Prompt The AI returns a `SCOPE CHECK` line and a single 8-block research prompt. 1. Copy the prompt into a fresh AI chat with web search enabled. 2. Submit the prompt. ### Step 4: Save the Output (Done in 1 Session!) The AI returns a complete **Weighted Evaluation Matrix (WEP)** artifact following [`templates/COMPARISON-SESSION.template.md`](../templates/COMPARISON-SESSION.template.md). The artifact includes: - Recommendation isolated from alternatives - Weighted scoring table (criteria weights summing to 1.0, 1–5 scores with evidence references) - Sensitivity analysis (testing top criteria weights at $\pm 20\%$) - Concrete failure modes for top contenders - Full Sources & Evidence Ledger (Grades A–E) Save the output to `research/sessions/D-TEST-RUNNER-cmp-test-runner.md`. No full ADR or FAD is required. ## Practical Tips & Troubleshooting ### 1. Which AI Models Work Best? For best results, select models with deep research capabilities and fresh search indices: | Model / Service | Ideal For | Notes | | --- | --- | --- | | **Gemini 2.5 Pro / Deep Research** | Deep multi-source web investigations, benchmark retrieval | Exceptional at crawling official documentation and RFCs | | **ChatGPT o3 / Deep Research** | Complex DAG generation, architectural trade-offs, logic | Strong causal reasoning for ADRs and ACH matrices | | **Claude 3.7 Sonnet (with Search)** | Prompt generation, FAD synthesis, crisp technical writing | Produces clean Markdown with strict adherence to templates | | **Perplexity Pro** | Fast empirical verification, gathering peer postmortems | Excellent citation cards for building Evidence Ledgers | > **Warning:** **Avoid Standard Unassisted Chat:** Never run research sessions with offline models or models with browsing disabled. LLM memory recall is capped at **Grade D** under Vivechak methodology. One-Way Doors cannot be locked on Grade D evidence. ### 2. Handling Sessions with Poor or Vague Output If a session produces generic summaries, hallucinated benchmarks, or lacks evidence grades: 1. **Never argue with the AI in a long thread.** Model adherence degrades significantly in long conversational turns. 2. **Re-anchor with the 8-Block structure:** Check if the prompt lost its `DONE`, `CALIBRATION`, or `FORMAT` block. 3. **Split the session:** If an AI produces shallow findings, the scope is likely too broad. Split it into two targeted sub-sessions (e.g., split `T1-01: Storage & Caching` into `T1-01A: Primary Datastore` and `T1-01B: Distributed Caching`). 4. **Try an alternative engine:** Run the exact same prompt in another frontier model. Comparing outputs frequently reveals where one model took lazy shortcuts. ### 3. When to Use Conflict Resolution Do not trigger a full ACH conflict resolution for minor aesthetic differences or trivial syntax preferences. Trigger [`templates/CONFLICT-RESOLUTION.template.md`](../templates/CONFLICT-RESOLUTION.template.md) when: - Two sessions recommend fundamentally incompatible architectures (e.g., Event Sourcing vs. CRUD). - Two models dispute a core empirical benchmark or concurrency limit. - A recommended tool has severe documented production failure modes discovered in recent postmortems. ### 4. Parallel Execution of Sessions - **Browser Tab Farm:** You can open 5 browser tabs simultaneously and run all Layer 0 sessions in parallel across different tabs or AI models. - **Model Triangulation:** For critical One-Way Doors (e.g., primary datastore or multi-tenant security boundary), run the exact same session prompt through **both** Claude 3.7 Sonnet and ChatGPT Deep Research. Compare their Evidence Ledgers to spot vendor bias or stale documentation. ### 5. Transitioning to the MCP Server Later If you start your project using this manual workflow and later decide to install the Vivechak MCP server: - Your workspace is **100% compatible**. - Run `vivechak doctor` in your terminal: it will validate your existing `research/` folder, check frontmatter schemas, and verify DAG integrity. - You can mix and match: use the CLI/MCP server for status checks and validation, while continuing to run deep research sessions in your browser. --- # Hybrid Execution & Concurrent Subagent Scaling > Combine MCP-automated sessions with browser triangulation, and scale multi-session DAG pipelines across concurrent subagents. ## Overview ### Scaling Research Throughput with Concurrent Subagents & Swarms ## Introduction Frontier AI harnesses can execute multiple tasks in parallel by spawning concurrent subagents. Vivechak pipelines are organized as **Directed Acyclic Graphs (DAGs)** where independent sessions can run concurrently without race conditions. This guide explains how parallel research execution works, how to detect parallel opportunities, and how Vivechak guarantees consistency across concurrent writers. ## Detecting Parallel Opportunities ### The `parallelism_hint` Field When calling `vivechak_next`, Vivechak evaluates the dependency graph against completed sessions. If more than one unblocked session is ready to execute, the response envelope's `data` object includes `other_ready_sessions` and `parallelism_hint` (and `next.why` summarizes the ready set): ```json { "ok": true, "message": "Ready session T1-01: Primary Database Engine", "data": { "session_id": "T1-01", "other_ready_sessions": ["T1-02", "T1-03"], "parallelism_hint": "PARALLEL EXECUTION AVAILABLE: 3 independent sessions can run simultaneously (T1-01, T1-02, T1-03).", "prompt": "# RESEARCH BRIEF: Primary Database Engine..." }, "next": { "tool": "vivechak_save", "args": { "kind": "session", "id": "T1-01" }, "why": "3 sessions ready in parallel (T1-01, T1-02, T1-03). Execute the prompt for session T1-01 with web search and grade claims A-E. Save with vivechak_save(kind=\"session\", id=\"T1-01\", content=...)." } } ``` ### Visualizing Parallel Tracks Call `vivechak_status(format="mermaid")` to inspect ready and parallel nodes: - Ready sessions are highlighted in **amber** (`#f59e0b`). - Completed sessions are highlighted in **green** (`#22c55e`). - Blocked downstream sessions are highlighted in **gray** (`#6b7280`). ## Subagent Spawning Pattern In an agent harness with subagent capabilities (such as Antigravity or Claude Code task runners), use this orchestration pattern: ```markdown graph TD Parent["Parent Coordinator Agent\n(Calls vivechak_next)"] Parent -->|Spawn Task 1| Sub1["Subagent 1\nResearches T1-01 (Database)"] Parent -->|Spawn Task 2| Sub2["Subagent 2\nResearches T1-02 (Cache)"] Parent -->|Spawn Task 3| Sub3["Subagent 3\nResearches T1-03 (Auth)"] Sub1 -->|Calls vivechak_save| Store["research/sessions/T1-01.md"] Sub2 -->|Calls vivechak_save| Store2["research/sessions/T1-02.md"] Sub3 -->|Calls vivechak_save| Store3["research/sessions/T1-03.md"] ``` ### Recommended Coordinator Prompt When dispatching a session to a subagent: 1. Provide the exact prompt returned by `vivechak_next`. 2. Instruct the subagent to perform its research and save the result directly using `vivechak_save(kind="session", id=..., content=...)`. 3. The parent agent waits for completion and queries `vivechak_next` for the next layer. ## Concurrency Guarantees & Lock Behavior Vivechak enforces file-level concurrency safety through advisory locks and atomic renames: | Operation | Lock Target | Lock Timeout | Behavior Under Contention | | --- | --- | --- | --- | | `vivechak_save` | `research/sessions/[ID].md` or `research/FAD.md` | 5 seconds | Exponential backoff. Overwrites safe via atomic rename. | | `vivechak_record_decision` | Target `D-*.md` + `research/DECISIONS.md` | 10 seconds | Registry compilation is serialized. Decisions sort naturally. | | `vivechak_amend` | Target session file or `research/FAD.md` | 5 seconds | Stale downstream notifications computed from DAG. | | `vivechak_replan` | `research/RESEARCH-PIPELINE.md` | 5 seconds | Eager mutex acquired before DAG read; graph mutation verified before serialization. | ### Windows Handle Collision Avoidance On Windows, high-concurrency subagents writing in the same millisecond can experience file-locking collisions. Vivechak utilizes a monotonic process-wide counter (`tmpFileCounter`) in `store.WriteFileAtomic` to ensure temporary write files never collide, even under parallel subagent load. ## Topological Execution Rules 1. **Intra-Layer Independence:** Sessions in the same layer that share no mutual dependencies are strictly order-independent. They can be started, paused, or finished in any sequence. 2. **Inter-Layer Synchronization:** A session in Layer 1 will remain blocked until **all** of its declared Layer 0 dependencies are completed. 3. **Grand Synthesis Barrier (`SYN-01`):** The final synthesis session (which compiles `research/FAD.md`) will **never** be unlocked until every preceding session in the DAG has completed successfully. --- # Adoption Walkthroughs & Dogfood Registry > Concrete walkthroughs across all 3 scope levels, plus real-world dogfood decision records audited continuously in CI. ## Overview Concrete end-to-end walkthroughs demonstrating how AI coding agents use Vivechak across all three scope levels — replayed and schema-checked in CI by `TestDocsFlows_ReplaysExampleWalkthroughs` (`cmd/vivechak/docs_flows_test.go`). ## Walkthroughs by Scope | Scope | Walkthrough | Scenario | Sessions & Overhead | Output Artifacts | | --- | --- | --- | --- | --- | | **1. Comparison** | [**`SAMPLE-COMPARISON.md`**](SAMPLE-COMPARISON.md) | Evaluating **Pino vs. Winston** for high-throughput Node.js JSON logging | 1 session (~5 min) · Zero DAG · Zero Gate | `research/C-001-comparison.md` (Weighted Evaluation Matrix + sensitivity check) | | **2. Decision** | [**`SAMPLE-DECISION.md`**](SAMPLE-DECISION.md) | Deciding whether to migrate analytical event logs from **PostgreSQL to ClickHouse** at 25M events/day | 2 sessions (`C` + `F`, ~30 min) · Track B Gate | `research/D-001-plan.md`, `research/D-001-decision.md`, `research/D-001-R1.md`, `research/DECISIONS.md` | | **3. Project** | [**`SAMPLE-PROJECT.md`**](SAMPLE-PROJECT.md) | Architecting **Katha**, an offline-first collaborative storytelling platform from scratch | Multi-layer DAG (`T1-*` → `SYN-01`) · Phase 0 Gate | `research/RESEARCH-PIPELINE.md`, `research/sessions/*.md`, `research/FAD.md`, `research/PHASE-0-GATE.md` | ## Live Dogfood Workspace (`examples/dogfood/`) [`dogfood/research/`](dogfood/research/) contains real architectural decision records (`D-001` through `D-003`) for Vivechak itself, audited continuously in CI via `vck doctor` and `vck gate`: ```markdown # Inspect workspace health and run the headless Phase 0 Gate on a scratch copy: cp -R examples/dogfood /tmp/vivechak-dogfood vck doctor /tmp/vivechak-dogfood vck gate --track all /tmp/vivechak-dogfood ``` --- # CLI Commands & Diagnostic Codes > Complete reference for vck subcommands (doctor, gate, setup, signoff, mcp-config, serve) and fail-closed exit codes. ## Quick Diagnostic: Run `vck doctor` Run the workspace integrity checker before inspecting files manually: ```markdown vck doctor /path/to/your/project # Or from inside your project repository: vck doctor ``` `vck doctor` checks: - **`research/`** directory structure and `.vivechak.json` metadata. - Unregistered or orphaned session files in `research/sessions/`. - Malformed or missing YAML frontmatter headers across `research/` and `research/sessions/`. - Non-UTF-8 bytes in research artifacts. - Stale decision references after ADR supersession and planned decisions lacking locked ADRs. ## Error, Validation, Warning & Coaching Codes Every operational error (`E-*`), structural or `vivechak-plan` validation error (`V-*`), warning (`W-*`), and quality coaching code (`Q-*`) emitted by Vivechak is generated from `internal/core/codes.go` in a single reference table: - **Full diagnostic code catalogue (all emitted codes + `fix` instructions):** [`docs/reference/codes.md`](reference/codes.md) - **Tool schemas & parameter constraints:** [`docs/reference/tools.md`](reference/tools.md) - **Phase 0 Exit Gate rule specifications (G1–G12):** [`docs/reference/gate.md`](reference/gate.md) ## Host & MCP Server Connection Issues ### Host reports "Server vivechak not found" or "Command failed" - **macOS GUI App PATH:** Desktop GUI hosts (such as Claude Desktop or Cursor) often do not inherit shell `PATH` additions from `.zshrc` or `.bash_profile`. Run `vck setup ` (for example `vck setup claude` or `vck setup cursor`) to write the launcher entry cleanly. - **Windows Path Escaping:** JSON files on Windows require escaped backslashes (`C:\\Users\\...\\vck.exe`); `vck setup ` writes valid JSON directly. ### Workspace resolution refused (`E-ROOT-UNRESOLVED`, `E-ROOT-SYSTEM`, or `E-ROOT-UNSAFE`) - Vivechak refuses to create `research/` inside `/`, `$HOME`, temp folders, OS/application install directories, or subdirectories lacking a project root anchor. - Pass `"project_root": "/abs/path/to/project"` in the tool call, or configure `"env": { "VCK_PROJECT_ROOT": "${workspaceFolder}" }` in your host's MCP config (see [`docs/hosts.md`](hosts.md)). ### Corrupt Host Configuration File on `vck setup` - **`vck setup`** and `vck mcp-config --write` fail closed on malformed JSON/JSONC/YAML and never overwrite or truncate an unparseable config file. Fix the syntax error in the target config file (or pass `--dry-run` to preview the minimal unified diff). ### Interactive Protocol Inspection ```markdown npx @modelcontextprotocol/inspector vck serve ``` ## Phase 0 Exit Gate Troubleshooting When `vivechak_gate` or `vck gate` reports `FAIL`, inspect `data.rules` (or terminal output) for the specific G1–G12 rule IDs: > **Note:** **Architectural Disclaimer:** The gate is necessary, not sufficient: it checks structure and the agent's own labels, not the truth of the sources. The sign-off is a typed attestation by the named reviewer; it raises the bar but is not a security boundary. Key Track B checks on accepted One-Way Door ADRs (full table in [`docs/reference/gate.md`](reference/gate.md)): 1. **Grade A/B Depth (G6) & Provenance (G7):** Include ≥2 Grade A/B claims with `https://` URLs and `fetched` or `human` (`human-provided`) verification labels in the ADR or its informing sessions (`informed_by_sessions` / `informs_decisions`). `recalled`, `cached`, `verified`, and `unverified` do not satisfy G7. 2. **No Placeholders & Substantive Alternatives (G8):** Remove all bracketed template placeholders and document substantive rejected alternatives. 3. **Measurable Review Trigger (G9):** Set a concrete metric or calendar `review_trigger` in frontmatter. 4. **Adversarial Red-Team Challenge (G10):** Run `vivechak_review(mode="red_team", id="")` (for example `id="D-001"`) on the decision itself, then cite the returned `record_id` (`D-001-R1`) with ≥50 characters of findings under `## Challenge Findings`. Re-run if the Decision Outcome changes later. 5. **Human Sign-Off (G11):** A human reviewer must run `vck signoff --reviewer ""` directly in an interactive terminal and type the decision ID when prompted; MCP tools reject agent-supplied sign-off fields with `E-HUMAN-ONLY-FIELD`. Headless CLI evaluation: ```markdown vck gate vck gate --track track_a vck gate --track track_b vck gate --format json ``` ## Concurrency & Advisory Lock Files (`*.lock`) During mutating operations (`vivechak_save`, `vivechak_record_decision`, `vivechak_amend`, `vivechak_replan`), Vivechak uses OS advisory file locks under `research/`. - Empty `0`-byte `.lock` files remain on disk after lock release by design (`flock` / `LockFileEx`) to avoid TOCTOU unlink races across concurrent processes, and are ignored via `research/.gitignore`. - If no `vck` process is writing to the workspace, `research/*.lock` files can be removed safely at any time. --- # 9 Consolidated MCP Tools Schema > Canonical tool definitions, input schemas, parameter annotations, and advisory locking semantics across the 9-tool MCP surface. ## Overview > **Note:** Generated from `internal/mcp` tool registrations (`go run ./tools/docgen`). Do not edit by hand. Vivechak exposes 9 Model Context Protocol (MCP) tools: | # | Tool | Required Parameters | Description | | --- | --- | --- | --- | | 1 | `vivechak_start` | `scope`, `question` | Start technical research (comparison, decision, or project). Returns a research brief to run with web search and an ID. Not for coding. | | 2 | `vivechak_save` | `kind`, `content` | Validate and persist research under research/ (comparison, plan, session, or fad). Needs revise=true to overwrite; invalid saves as draft. | | 3 | `vivechak_record_decision` | `id` | Create or update an ADR or conflict resolution and compile DECISIONS.md. Supports auto_draft_from, auto_save, status, and supersedes. | | 4 | `vivechak_next` | *(none)* | Return the next ready session prompt from the plan DAG with upstream findings injected as data. | | 5 | `vivechak_status` | *(none)* | Show workspace status, sessions, decisions, and progress (summary, table, or mermaid). Read-only. | | 6 | `vivechak_review` | `mode` | Check research: validate (content or id), evidence (citation audit), red_team (writes challenge record), or consistency. | | 7 | `vivechak_amend` | `id`, `note` | Append a dated amendment to a saved session, ADR, FAD, or comparison and flag stale dependents. | | 8 | `vivechak_replan` | `plan`, `op` | Edit a plan DAG in place (add_session, remove_session, update_deps, update_prompt); protects completed sessions. | | 9 | `vivechak_gate` | *(none)* | Evaluate Phase 0 exit criteria (G1-G12) for the workspace or one ADR and write PHASE-0-GATE.md (one-way needs vck signoff). | ## `vivechak_start` Start technical research (comparison, decision, or project). Returns a research brief to run with web search and an ID. Not for coding. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `scope` (string, required): Research scope: comparison (2-5 options), decision (ADR), or project (pipeline -> FAD). Allowed: `"comparison"`, `"decision"`, `"project"`. - `question` (string, required): Technical dilemma, options to compare, or project vision. - `options` (string[], optional): Named options for comparison scope. - `criteria` (string, optional): Optional evaluation criteria or constraints. - `part` (integer, optional): 1-based part index for multi-part project briefs. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_save` Validate and persist research under research/ (comparison, plan, session, or fad). Needs revise=true to overwrite; invalid saves as draft. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `kind` (string, required): Artifact kind: plan, session, comparison, or fad. Allowed: `"plan"`, `"session"`, `"comparison"`, `"fad"`. - `content` (string, required): Markdown content to validate and save. - `id` (string, optional): Artifact or session ID (allocated when omitted for comparison/plan). - `scope` (string, optional): Optional scope hint when saving a plan. Allowed: `"comparison"`, `"decision"`, `"project"`. - `slug` (string, optional): Optional URL-safe filename slug. - `revise` (boolean, optional): Update an existing artifact, archiving the old version. - `decisions_content` (string, optional): Initial ADR stub or registry Markdown when saving a plan. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_record_decision` Create or update an ADR or conflict resolution and compile DECISIONS.md. Supports auto_draft_from, auto_save, status, and supersedes. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `id` (string, required): Decision ID (e.g. D-001, or D-NEW to allocate the next free ID). - `content` (string, optional): Decision or conflict-resolution Markdown (omit when using auto_draft_from). - `auto_draft_from` (string, optional): Session ID (e.g. D-001-S1) to draft the ADR from. - `auto_save` (boolean, optional): Save the drafted ADR immediately when using auto_draft_from. - `status` (string, optional): Lifecycle status written into frontmatter before validation. Allowed: `"proposed"`, `"accepted"`, `"rejected"`, `"superseded"`, `"deprecated"`. - `slug` (string, optional): Optional URL-safe filename slug. - `supersedes` (string, optional): Existing decision ID superseded by this ADR (e.g. D-001). - `revise` (boolean, optional): Overwrite an existing ADR with history archiving. - `artifact_type` (string, optional): Artifact type: decision (default) or conflict-resolution. Allowed: `"decision"`, `"conflict-resolution"`. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_next` Return the next ready session prompt from the plan DAG with upstream findings injected as data. - **Annotations:** `readOnlyHint=true`, `idempotentHint=true`, `destructiveHint=false`, `openWorldHint=false` - **Parameters:** - `session_id` (string, optional): Specific session ID to retrieve (default: next ready session). - `verbose` (boolean, optional): Return full prompt without 10K-token truncation. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_status` Show workspace status, sessions, decisions, and progress (summary, table, or mermaid). Read-only. - **Annotations:** `readOnlyHint=true`, `idempotentHint=true`, `destructiveHint=false`, `openWorldHint=false` - **Parameters:** - `format` (string, optional): Output format: summary (default), table, or mermaid. Allowed: `"summary"`, `"table"`, `"mermaid"`. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_review` Check research: validate (content or id), evidence (citation audit), red_team (writes challenge record), or consistency. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=false`, `openWorldHint=false` - **Parameters:** - `mode` (string, required): Review mode: validate, evidence, red_team, or consistency. Allowed: `"validate"`, `"evidence"`, `"red_team"`, `"consistency"`. - `id` (string, optional): Target session, decision, comparison, or plan ID. - `content` (string, optional): Inline Markdown content for dry-run validate mode. - `artifact_type` (string, optional): Artifact type when validating inline content. Allowed: `"session"`, `"decision"`, `"comparison"`, `"plan"`, `"fad"`, `"conflict-resolution"`. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_amend` Append a dated amendment to a saved session, ADR, FAD, or comparison and flag stale dependents. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `id` (string, required): Session, decision, comparison, or synthesis ID to amend. - `note` (string, required): Amendment Markdown note to append. - `reason` (string, optional): Short summary of why the artifact is being amended. - `amending_session_id` (string, optional): Session ID that discovered the amendment. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_replan` Edit a plan DAG in place (add_session, remove_session, update_deps, update_prompt); protects completed sessions. - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `plan` (string, required): Target plan: PROJECT or decision ID (e.g. D-001). - `op` (string, required): Replan operation to perform. Allowed: `"add_session"`, `"remove_session"`, `"update_deps"`, `"update_prompt"`. - `session_id` (string, optional): Target session ID (e.g. T1-02). - `reason` (string, optional): Rationale for the plan change. - `layer` (string, optional): DAG layer number for add_session. - `topic` (string, optional): Session title for add_session. - `prompt` (string, optional): Session prompt text for add_session or update_prompt. - `dependencies` (string, optional): Comma-separated dependency session IDs for add_session or update_deps. - `door_type` (string, optional): Door classification for add_session. Allowed: `"one-way"`, `"two-way"`. - `decision_ref` (string, optional): Informed decision ID for add_session. - `project_root` (string, optional): Absolute path to the target project directory. ## `vivechak_gate` Evaluate Phase 0 exit criteria (G1-G12) for the workspace or one ADR and write PHASE-0-GATE.md (one-way needs vck signoff). - **Annotations:** `readOnlyHint=false`, `idempotentHint=false`, `destructiveHint=true`, `openWorldHint=false` - **Parameters:** - `decision` (string, optional): Specific decision ID to evaluate (e.g. D-001). - `track` (string, optional): Track filter: all (default), track_a, or track_b. Allowed: `"all"`, `"track_a"`, `"track_b"`. - `verbose` (boolean, optional): Include verbose rule diagnostics. - `project_root` (string, optional): Absolute path to the target project directory. --- # Phase 0 Exit Gate Rules (G1–G12) > Dual-track mechanical pre-codebase exit criteria: Track A reversibility confirmation and Track B evidentiary depth. ## Overview > **Note:** Generated from `internal/core/gate_rules_spec.go` (`go run ./tools/docgen`). Do not edit by hand. The Phase 0 Gate is Vivechak's mechanical pre-codebase exit audit (`vivechak_gate` / `vck gate`). It checks that architectural decisions are grounded, reversible or signed off, and traceable before implementation begins. > **Note:** **Architectural Disclaimer:** The gate is necessary, not sufficient: it checks structure and the agent's own labels, not the truth of the sources. The sign-off is a typed attestation by the named reviewer; it raises the bar but is not a security boundary. ## Dual-Track Architecture | Track | Target Decisions | Governing Rules | Philosophy | | --- | --- | --- | --- | | **Track A** | **Two-Way Doors** (Reversible) | Rule G12 | **Velocity-Calibrated:** Fast spike or convention decision (~70% information) with reversibility path and review trigger. | | **Track B** | **One-Way Doors** (Hard to Reverse) | Rules G1–G11 | **Rigor-Calibrated:** Grade A/B claims with URLs, `fetched`/`human` provenance, substantive rejected alternatives, red-team challenge record, and interactive human sign-off (`vck signoff`). | ## Mechanical Gate Rules Ledger | Rule | Name | Track | Verification Criteria | | --- | --- | --- | --- | | **G1** | Plan & DAG Validity | Track B | Plan file parses via its `yaml vivechak-plan` block with no cycles or unknown dependencies, and project pipelines declare exactly one `kind: synthesis` session. | | **G2** | Session Completeness & Quality | Track B | Every non-synthesis session has `status: complete` and substantive, non-stub research content without blocking validation issues. | | **G3** | FAD Synthesis Contract | Track B | Project scope has a completed `research/FAD.md` with no blocking issues, and every accepted ADR appears in the Locked Registry. | | **G4** | Decision Traceability | Track B | Every decision ID referenced by plan or session `informs_decisions` exists as an ADR in `research/`. | | **G5** | Locked ADR Status | Track B | Target ADRs are locked (`accepted`, `superseded`, or `rejected`); none remain `proposed`. | | **G6** | One-Way Door Grade A/B Depth | Track B | Accepted One-Way Door ADRs carry ≥2 Grade A/B claims, each on a line or ledger row with its `https://` URL, in the ADR or the sessions that inform it (`[A · single · fresh · direct · fetched](url)`, `[Grade A: url \ | fetched]`, `(Grade A · corroborated · fresh \ | fetched)`, or an evidence-ledger row whose Grade cell is `A` or `B`). | | **G7** | Verification Provenance | Track B | Of the claims G6 counts, ≥2 carry the verification label `fetched` or `human` (`human-provided`) in the tag's last field or the ledger row's Verification cell; `cached`, `recalled`, `verified`, `unverified`, and prose words never count. Labels are as reported by the agent; Vivechak does not fetch or verify sources. | | **G8** | No Placeholders & Rejected Alternatives | Track B | Accepted One-Way Door ADRs contain no unexpanded template placeholders and document substantive rejected alternatives. | | **G9** | Measurable Review Trigger | Track B | Accepted One-Way Door ADRs declare a concrete, non-placeholder `review_trigger` threshold or review date. | | **G10** | Adversarial Red-Team Challenge | Track B | Accepted One-Way Door ADRs have a current challenge record (`research/D-NNN-R.md` matching `decision_hash` from `vivechak_review(mode="red_team", id="D-NNN")`) cited with ≥50 chars in `## Challenge Findings`. | | **G11** | Human Architectural Sign-Off | Track B | Accepted One-Way Door ADRs carry a valid `vck signoff` attestation (`human_reviewed: true`, `reviewed_by`, `reviewed_at`, and matching `reviewed_hash`). | | **G12** | Two-Way Door Reversibility | Track A | Accepted Two-Way Door ADRs confirm reversibility rationale, non-placeholder content, and a `review_trigger`. | --- # Diagnostic & Quality Coaching Codes (E-*, W-*, Q-*) > Catalog of all 78 operational errors, structural validation diagnostics, warnings, and non-blocking real-time quality coach codes. ## Overview > **Note:** Generated from `internal/core/codes.go` (`go run ./tools/docgen`). Do not edit by hand. Vivechak emits 78 structured codes across its MCP envelope, structural/plan validator, warning diagnostics, and quality coach: ## Operational Error Codes (`E-*`) Returned on failed operations (`ok: false`, `isError: true`) with remediation in `fix`. | Code | Message | Remediation (`fix`) | | --- | --- | --- | | `E-CONFINEMENT` | Target artifact path escapes research/ or the workspace boundary. | Write artifacts only under research/ within the resolved project workspace. | | `E-HUMAN-ONLY-FIELD` | Agent attempted to set a human-only sign-off field (human_reviewed, reviewed_by, reviewed_at, reviewed_hash). | Remove the sign-off fields and ask a human reviewer to run 'vck signoff --reviewer ""' in an interactive terminal. | | `E-ID-CONFLICT` | Target file already exists on disk with a different artifact identifier. | Use a distinct id or slug for a new artifact, or match the existing file's id with revise=true. | | `E-ID-INVALID` | Artifact or session identifier is malformed or does not match the artifact kind. | Use D-NNN for decisions, C-NNN for comparisons, or a valid session ID such as T1-01 (or D-NEW to allocate). | | `E-INTERNAL` | Unexpected internal error while handling request. | Inspect server stderr diagnostics and retry the operation. | | `E-INVALID-ARGUMENT` | Tool argument is missing, has the wrong type, or is outside its allowed values. | Pass arguments matching the tool's inputSchema in tools/list. | | `E-IO` | Filesystem read, directory creation, or atomic write failed in the workspace. | Verify that the workspace directory exists and is writable, then retry. | | `E-LOCK-TIMEOUT` | Timed out waiting to acquire the advisory file lock for an artifact. | Wait for concurrent writes to finish and retry the call. | | `E-NOT-FOUND` | Requested plan, session, comparison, or decision file does not exist in research/. | Save the prerequisite artifact first or inspect available IDs with vivechak_status. | | `E-NOT-INITIALIZED` | Workspace does not contain an initialized research/ directory yet. | Call vivechak_start with scope and question to initialize the workspace first. | | `E-PLACEHOLDER-REMAINS` | Unexpanded template placeholders remain in an artifact that requires concrete content. | Replace all bracketed template placeholders with grounded findings before saving as complete or accepted. | | `E-REVISE-REQUIRED` | Target artifact already exists with different content and revise=true was not set. | Pass revise=true to update that same artifact (archiving the old copy in research/.history/), or omit id for a new artifact. | | `E-ROOT-AMBIGUOUS` | Client advertised multiple MCP workspace roots and no explicit project_root was given. | Pass project_root explicitly with the target project's absolute directory path. | | `E-ROOT-INVALID` | Explicit or configured workspace root path does not exist or is not a directory. | Pass an existing project directory path in project_root. | | `E-ROOT-SYSTEM` | Candidate directory is a system, home, or application directory rather than a project. | Pass project_root pointing to your project repository. | | `E-ROOT-UNRESOLVED` | Could not resolve a safe project workspace root from arguments, client roots, environment, or cwd. | Pass project_root with the absolute path of the user's project directory. | | `E-ROOT-UNSAFE` | Workspace path is empty or points to a restricted filesystem root, home, temp, or OS directory. | Choose a dedicated project directory inside your workspace. | | `E-SESSION-COMPLETED` | Attempted to remove or alter the plan definition of an already completed research session. | Keep completed sessions intact and append post-hoc updates with vivechak_amend. | | `E-TTY-REQUIRED` | vck signoff was invoked without an interactive terminal session. | Ask a human reviewer to run 'vck signoff --reviewer ""' directly in an interactive terminal. | ## Structural & Plan Validation Codes (`V-*`) Emitted during artifact or plan validation (`vivechak_save`, `vivechak_record_decision`, `vivechak_review`). | Code | Message | Remediation (`fix`) | | --- | --- | --- | | `V-CMP-NO-MATRIX` | Comparison artifact lacks a Weighted Evaluation Protocol (WEP) Markdown table. | Include a criterion-by-option Markdown table with weights and 1-5 scores. | | `V-CMP-OPTIONS` | Comparison matrix evaluates fewer than two distinct options. | Compare between 2 and 5 named options as columns in the WEP matrix. | | `V-CMP-SCORES` | Comparison matrix cells lack valid numeric 1-5 option scores. | Score every option on every criterion from 1 to 5 backed by graded citations. | | `V-CMP-WEIGHTS` | Comparison criterion weights are missing or do not normalize to 1.0 (or 100%). | Assign positive criterion weights that sum to 1.0 (e.g. 0.40, 0.35, 0.25). | | `V-EMPTY` | Artifact content is empty. | Provide complete Markdown content matching the artifact's template. | | `V-EMPTY-BODY` | Artifact contains YAML frontmatter but no Markdown body. | Write the research findings, trade-offs, and evidence ledger below the frontmatter fence. | | `V-INVALID-FRONTMATTER` | YAML frontmatter block is syntactically malformed. | Fix YAML syntax errors between the opening and closing --- fences. | | `V-MISSING-FIELD` | Required YAML frontmatter field is missing. | Add the missing required key to the YAML frontmatter block. | | `V-MISSING-FRONTMATTER` | Artifact is missing its opening YAML frontmatter block. | Begin the document with a --- YAML frontmatter block containing required metadata. | | `V-MISSING-SECTION` | Required Markdown section heading is missing from the artifact. | Add all required Markdown sections for the scope template. | | `V-MISSING-STATUS` | Session frontmatter does not declare status. | Set status: complete (or draft) in the session's YAML frontmatter. | | `V-NO-GRADED-CLAIM` | Artifact contains no inline evidence grades (A-E). | Grade factual claims A-E with modifiers, verification labels, and source URLs. | | `V-OWD-NO-CONCERNS` | One-Way Door session lacks a substantive Discovered Concerns section. | Add a ## Discovered Concerns section (>=50 chars) detailing failure modes and disconfirming evidence. | | `V-OWD-VAGUE-PROVENANCE` | One-Way Door Grade A/B claim lacks a concrete URL or primary standard anchor. | Attach a canonical https:// URL to every Grade A/B claim informing a One-Way Door. | | `V-PLACEHOLDER` | Unexpanded template placeholder remains in the comparison output. | Replace all template placeholders with concrete option analysis and scores. | | `V-PLAN-CYCLE` | Plan session dependency graph contains a cycle or depends on the synthesis session. | Remove circular depends entries so sessions form a DAG ending at kind: synthesis. | | `V-PLAN-DUPLICATE-PROMPT` | Plan contains multiple ### : prompt sections for the same session. | Keep exactly one ### : section with one prompt fence per session. | | `V-PLAN-INVALID-BLOCK` | Plan's yaml vivechak-plan block is invalid, duplicated, or uses unknown keys. | Keep one valid yaml vivechak-plan block using plan, sessions, and decisions keys. | | `V-PLAN-MISSING-BLOCK` | Plan lacks the required fenced yaml vivechak-plan block. | Add one ```yaml vivechak-plan block declaring plan and sessions. | | `V-PLAN-MISSING-PROMPT` | Session declared in vivechak-plan has no prompt fence under ## Sessions. | Add ### <id>: <title> followed by one ```prompt fence under ## Sessions. | | `V-PLAN-NO-SESSIONS` | Plan declares zero research sessions. | Declare at least one session in the vivechak-plan block's sessions list. | | `V-PLAN-SYNTHESIS` | Project pipeline does not have exactly one kind: synthesis session. | Set kind: synthesis on the single terminal synthesis session in the project plan. | | `V-PLAN-UNKNOWN-DEPENDENCY` | Session depends on a session ID not declared in the plan. | List only session IDs declared in the same vivechak-plan block (or [ALL] on synthesis). | | `V-PLAN-UNLISTED-SESSION` | Prompt section under ## Sessions is not declared in the vivechak-plan block. | Add the session to the vivechak-plan sessions list or remove the extra section. | | `V-TOO-SHORT` | Artifact body is shorter than the minimum substantive length. | Expand the evidence-graded analysis and trade-off discussion before saving. | ## Operational & Advisory Warning Codes (`W-*`) Returned in `warnings` (`[{code, message, fix}]`) without failing the request. | Code | Message | Remediation (`fix`) | | --- | --- | --- | | `W-CMP-GATE-NA` | Comparison scope has no Phase 0 architecture gate requirements. | Proceed to implementation, or start decision scope if locking an ADR. | | `W-DECISIONS-COMPILE` | Individual ADR was saved, but recompiling research/DECISIONS.md failed. | Check write permissions on research/DECISIONS.md and re-run vivechak_record_decision. | | `W-GATE-RULE-ISSUE` | Phase 0 Gate surfaced a rule failure or structural check issue. | Inspect data.rules and resolve each failing check before coding. | | `W-GATE-WRITE` | Phase 0 Gate ran, but persisting research/PHASE-0-GATE.md failed. | Check write permissions under research/ and re-run vivechak_gate. | | `W-ID-ALLOCATED` | Omitted or placeholder identifier was resolved to a server-allocated ID. | Use the allocated ID returned in data.id on subsequent tool calls. | | `W-INJECT-FAILED` | Upstream session context could not be injected; serving raw session prompt. | Verify upstream session files under research/sessions/ are readable. | | `W-INJECTION-SIZE` | Injected upstream findings exceed the recommended context budget. | Keep upstream Key Findings and Recommendation sections concise. | | `W-INVALID-DATE-FORMAT` | Frontmatter date is not in YYYY-MM-DD format. | Format frontmatter date as ISO YYYY-MM-DD. | | `W-LAYER-TRANSITION` | All sessions in the prior DAG layer are complete; advancing to the next layer. | Check whether findings warrant vivechak_replan before running downstream sessions. | | `W-MARKER-CONFLICT` | ADR body contains nested HTML decision registry markers. | Remove manual <!-- DECISION: ... --> markers from individual ADR files. | | `W-MISSING-DATE` | Frontmatter omits the date field. | Add date: YYYY-MM-DD to the YAML frontmatter. | | `W-MISSING-DOOR-TYPE` | Artifact omits door_type (one-way or two-way). | Set door_type: one-way or door_type: two-way in YAML frontmatter. | | `W-MISSING-FIELD` | Recommended YAML frontmatter field is missing. | Add the recommended field to the YAML frontmatter. | | `W-MISSING-FRONTMATTER` | Artifact omits optional YAML frontmatter. | Add YAML frontmatter with id, title, date, and status. | | `W-NO-CONCERNS` | Two-Way Door session omits a Discovered Concerns section. | Add ## Discovered Concerns noting caveats or operational risks. | | `W-NO-EVIDENCE-GRADES` | Artifact body contains no inline evidence grade markers. | Tag factual claims with grades A-E (see vivechak://methodology/grades). | | `W-OUTPUT-SIZE` | Session prompt exceeded 10K estimated tokens and was truncated. | Call vivechak_next with verbose=true to fetch the full prompt. | | `W-OWD-NO-CHALLENGE` | One-Way Door ADR lacks a current adversarial red-team challenge record. | Run vivechak_review(mode="red_team", id="<D-id>") and cite the returned record_id. | | `W-PLACEHOLDER-REMAINS` | Proposed draft ADR still contains unexpanded template placeholders. | Replace every placeholder before marking status: accepted. | | `W-PRE-SYNTHESIS-GAP` | Completed One-Way Door session has evidentiary or challenge gaps before synthesis. | Amend weak One-Way Door sessions via vivechak_amend before running vivechak_gate. | | `W-RECALLED-GRADE-CAP` | Claim labelled recalled or parametric is graded higher than Grade D. | Cap model-recall claims at Grade D or verify with web search and cite the source URL. | | `W-SHORT-BODY` | Artifact Markdown body is unusually short. | Expand empirical findings, trade-offs, and citations if incomplete. | | `W-SHORT-DECISION` | Decision record body is unusually short. | Document context, decision outcome, rejected alternatives, and reversal triggers. | | `W-STALE-DECISION-REFERENCE` | Saved session references an ADR that has been superseded. | Review the session and append an update with vivechak_amend if needed. | | `W-STALE-DOWNSTREAM` | Completed downstream sessions depend on an artifact that was amended. | Review listed downstream sessions and amend them if conclusions changed. | | `W-UNKNOWN-ARG` | Tool call included unknown argument name(s), which were ignored. | Pass only parameter names declared in the tool's inputSchema. | | `W-VAGUE-PROVENANCE` | Grade A/B claim lacks an explicit URL or standard identifier. | Include a canonical https:// URL on the claim line or ledger row. | ## Cognitive Quality Coaching Codes (`Q-*`) Surfaced non-blockingly on session saves and reviews to highlight evidentiary gaps. | Code | Message | Remediation (`fix`) | | --- | --- | --- | | `Q-BIAS` | Session Delta lists no contradicted or updated beliefs, suggesting possible confirmation bias. | Actively test disconfirming evidence and record how initial assumptions changed in ## Delta. | | `Q-CONCERNS` | Session omits or under-develops the ## Discovered Concerns section. | Document concrete failure modes, operational caveats, and limitations in ## Discovered Concerns. | | `Q-DEPTH` | Session contains fewer than the recommended 4-7 graded key findings. | Expand ## Key Findings with additional empirically graded claims where warranted. | | `Q-EVIDENCE` | Session evidence count, URL anchoring, or grade mix warrants review. | Anchor Grade A claims with primary URLs and cite multiple independent sources. | | `Q-FRESHNESS` | Session cites potentially stale year references (>2 years old). | Verify version-sensitive claims against current upstream documentation. | | `Q-RIGOR` | Session recommends an option without documenting evaluated alternatives. | Add an ## Alternatives Considered section weighing rejected candidates and trade-offs. | | `Q-STRUCTURE` | Session omits ## Prior or ## Delta belief-tracking sections. | Include both ## Prior and ## Delta to show how evidence updated initial assumptions. | --- <!-- Route: https://vivechak.bhaskarjha.dev/docs/methodology --> # Epistemic Framework & Evidence Grading Specification > The 8 Core Principles, Admiralty-derived A–E evidence grading system, WEP sensitivity analysis, and anti-pattern guardrails. ## Overview ### Complete Specification for Evidence-Grounded Technical Research *Version 0.1.0 — Empirically Validated via 11 Meta-Research Sessions* ## Executive Philosophy & The Three Research Scopes > **Note:** **The Research-First Law:** *Investigate irreversible architectural decisions and comparative choices with graded, verifiable evidence — whether architecting a new system on Day 0, resolving an architectural dilemma on Day 30, or evaluating competing technologies on Month 6. Develop nothing based on cached assumptions, outdated training data, or hallucinated consensus.* Technical failures and architectural rewrites are rarely caused by poor implementation — they are caused by **premature decisions made on unverified assumptions.** Vivechak is an evidence-grounded research meta-framework that discovers, evaluates, resolves, and grounds technical decisions across the software lifecycle. ### The Three Research Scopes Vivechak operates at three distinct scope levels calibrated to decision blast radius: ```markdown ┌──────────────────┬──────────────────┬──────────────────┬────────────────────────┐ │ 1. Comparison │ 2. Decision │ 3. Project │ 4. OUT OF SCOPE │ │ (WEP Matrix) │ (ADR D-NNN) │ (FAD Pipeline)│ (NO Vivechak) │ ├──────────────────┼──────────────────┼──────────────────┼────────────────────────┤ │ • 1 session │ • 1–3 sessions │ • 4–30 sessions │ • 0 sessions │ │ • ~5 minutes │ • ~30 minutes │ • Full pipeline │ • Direct execution │ │ • 0 DAG │ • 0 DAG │ • Topological DAG│ • Zero ceremony │ │ • 0 FAD / 0 Gate │ • 0 FAD │ • FAD + Phase 0 │ • No MCP tools called │ │ • 1 template │ • 2 templates │ • 6 templates │ │ └──────────────────┴──────────────────┴──────────────────┴────────────────────────┘ ``` 1. **Comparison Scope (`GENERATOR-COMPARISON.md`):** Rapid evaluation between 2–5 options producing an evidence-graded Weighted Evaluation Protocol (WEP) matrix in a single session without DAG or gate overhead. 2. **Decision Scope (`GENERATOR-DECISION.md`):** Focused investigation for an architectural dilemma in an existing project, producing a validated Architectural Decision Record (ADR) in 1–3 sessions. 3. **Project Scope (`GENERATOR-PROJECT.md`):** Greenfield system architecture or major platform rewrite, decomposing uncertainty into an information DAG, synthesizing findings into a Founding Architecture Document (FAD), and verifying pre-codebase exit criteria via the Phase 0 Gate. *(For detailed scope methodology, invariants I1–I9, and decision routing, see [§9. Multi-Scope Research](#9-multi-scope-research).)* ### Positioning: What Vivechak Is vs. What Vivechak Is Not | What Vivechak IS | What Vivechak IS NOT | | --- | --- | | **Epistemic Grounding Engine:** Pre-coding research meta-framework providing empirical evidence grades (`E-A` through `E-E`) | **A Code Generator:** It does not write production code, components, endpoints, or scripts | | **Architectural Gatekeeper:** Enforces pre-coding exit criteria (`Track A` Two-Way vs. `Track B` One-Way Doors) with interactive human sign-off (`vck signoff`) | **A Linter or Static Analyzer:** It does not analyze ASTs, enforce formatting, or typecheck code | | **Reversibility-Calibrated Sieve:** 1-session comparisons (`C-NNN`), 1–3 session ADRs (`D-NNN`), or multi-session DAG pipelines | **An Autonomous Orchestrator for Everything:** Not an open-ended loop for routine programming tasks | | **Structured Falsification:** Mandates disconfirming evidence searches, substantive discovered concerns, and premortems | **A Prompt Persona:** No expert persona roleplays, XML prompt bloat, or arbitrary search count quotas | ### How Project Scope Operates (Full Pipeline) ```markdown PROJECT VISION │ ▼ ┌─────────────────────────────────────────────────────┐ │ COMPLEXITY SCORING (8 dimensions, 0–24 pts) │ │ → Determines research depth tier (0–3) │ │ → Routes each decision by reversibility │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ CONSTRAINED DAG EXECUTION │ │ Sessions run when dependencies are satisfied │ │ Default: unblocked. Hard deps block; soft don't. │ │ Adaptive checkpoints expand/contract scope │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ STAGED TRIANGULATION & EVIDENCE GRADING │ │ Single-model default → critique probe → │ │ full triangulation (One-Way Doors only) │ │ A–E grades + modifiers + verification tracking │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ TWO-TRACK PHASE 0 GATE │ │ Track A: Fast-track for Two-Way Doors │ │ Track B: Rules G1–G11 gate + premortem for One-Way Doors │ └───────────────────────┬─────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ FOUNDING ARCHITECTURE DOCUMENT (FAD) │ │ Map-Reduce synthesis → sealed specification │ │ → Repository scaffolding begins │ └─────────────────────────────────────────────────────┘ ``` ## Core Principles Vivechak v0.1.0 is governed by 8 evidence-grounded principles. Each was empirically validated through the meta-research pipeline and cites its supporting evidence. ### P1: The Context Architecture Law *Supersedes: pre-validation Aspect-Isolation Law* Research quality is governed by **attention budget, context purity, and task boundaries** — not by arbitrary session counts. The constraint is real (token/search budget is the dominant predictor of performance on web research benchmarks — OpenAI BrowseComp scaling analysis), but the remedy is conditional decomposition, not blanket fragmentation. **Rules:** - Decompose into dedicated research contexts when sub-tasks have low interdependency, high individual complexity, or divergent search spaces. - Integrate coupled topics into structured joint sessions when evaluating holistic system tradeoffs. - Every decomposed investigation **must** conclude with an explicit downstream synthesis pass. - Over-isolation triggers the split-attention effect, introduces 4–15× token overhead, and misses systemic cross-cutting trade-offs. > **Note:** **Evidence:** E-001 (OpenAI BrowseComp — accuracy scales with search budget/compute), E-002 (MTI +12.4% on joint tasks), E-003 (Chandler & Sweller split-attention), E-004 (Chroma context rot) > **Note:** **Terminology note:** P1 aligns with the 2025-2026 "context engineering" paradigm — the systematic design of what information reaches a model's context window, in what form, and at what priority. Vivechak's decomposition-by-attention-budget and synthesis-after-decomposition rules are specific operational principles within that broader discipline. ### P2: Reversibility-Calibrated Rigor The depth of research, evidentiary burden, and review overhead allocated to a decision must scale directly with its **reversibility and blast radius**. | Door Type | Definition | Research Depth | Evidence Bar | | --- | --- | --- | --- | | **One-Way (Type 1)** | Consequential, costly/impossible to reverse (primary datastore, data model, auth architecture, core language/runtime, regulatory compliance, public API contracts, hosting infrastructure, deployment architecture) | Deep research, multi-session, corroborated evidence | Grade A/B, human review, premortem | | **Two-Way (Type 2)** | Cheap, fast to reverse (UI framework, styling, CI tooling, non-core utility libraries) | Fast spike or convention decision on ~70% information | Grade B/C acceptable, no gate required | > **Note:** **Evidence:** E-010 (Cynefin), E-011 (DORA defect concentration), E-012 (Amazon Type 1/2 doors) ### P3: Evidentiary Grounding & Verification Provenance No technical assertion or architectural decision may be accepted without: - An explicit **evidence grade** (A through E) - **Provenance tracking** (`verification_method`: fetched, cached, recalled, secondhand, human-provided) - **Contextual modifiers** (corroboration, recency, directness) **Hard rule:** Unverified AI parametric recall is capped at Grade D. Zero recalled citations may support One-Way Door decisions. > **Note:** **Evidence:** E-013 (GRADE framework), E-014 (Admiralty Code collapse), E-015 (AI citation confabulation) ### P4: Prescriptive Scope, Dynamic Method *Supersedes: pre-validation 8-section XML prompt anatomy* Research briefs must be: - **Prescriptive** on WHAT to investigate, WHY it matters, WHAT boundaries apply, and WHAT coverage is required. - **Directional** on HOW to execute: no pre-scripted search queries, no artificial search counts, no expert role-playing personas, no rigid output skeletons. **Bounded Exploration Mandate:** Prescriptive scope defines the **minimum coverage floor**, not a ceiling. If research reveals critical concerns, risks, dependencies, or opportunities beyond the stated scope that are material to the decision being informed, the researching agent should investigate and include them — justified with evidence. This prevents the "hyper-literalism" effect where frontier models constrain their native reasoning to only the explicitly listed elements, missing emergent or adjacent concerns the prompt author could not have anticipated. Front-load the complete brief in a single turn. Never drip-feed instructions across multiple turns (39% performance drop documented). > **Note:** **Evidence:** E-017 (Laban et al. ICLR 2026, 39% multi-turn drop), E-018 (persona debunking), E-019 (ReAct paradigm), E-020 (format restriction penalty) **Audience framing vs. persona assignment:** Specifying the target audience (e.g., "a Principal Architect needing production-grade tradeoffs") sets the QUALITY BAR for the output. This is distinct from persona assignment (e.g., "You are an expert database engineer"), which attempts to alter the model's reasoning behavior. Audience framing is prescriptive scope (WHAT quality level); persona assignment is method prescription (HOW to think). The former is permitted under P4; the latter is empirically refuted. **The Zero-Tooling Boundary (Out-of-Scope Protection):** Vivechak's evidentiary rigor applies strictly to technical choices, comparisons, architectural evaluations, and system design. It must **never** be invoked for routine code implementation, syntax questions, local debugging, or micro-refactoring. Applying research ceremonies to everyday programming triggers cognitive friction, slows development, and wastes model attention budget. ### P5: Commodity-Maximized Composition *Supersedes: pre-validation fixed ~40/60 ratio* - **Compose 100%** of commodity/utility components from battle-tested providers (Auth, DB, Storage, Queues, UI primitives, CI/CD). - **Build 100% custom** only for proprietary domain intelligence, core state machines, differentiated business logic, and unique algorithms. The ratio varies by domain. Use Wardley evolution mapping, not fixed percentages. > **Note:** **Evidence:** E-024 (Wardley mapping), E-025 (Fowler MonolithFirst), E-026 (DORA loosely-coupled architecture) ### P6: Dual-Audience Artifact Architecture Research outputs must serve both human readers and machine consumers: - **Hybrid Markdown + YAML frontmatter** — human-readable body with machine-parseable metadata. - **Standardized 7-section H2 skeleton** — consistent structure enabling automated Map-Reduce synthesis. - **Strict separation** between `Recommendation` and `Alternatives Considered` — prevents AI code-generation contamination from rejected options. > **Note:** **Evidence:** E-021 (MADR 4.0), E-022 (GraphRAG header chunking), E-023 (Git diff mechanics) ### P7: Staged Triangulation & Diagnostic Disagreement *Supersedes: pre-validation mandatory 3-model triangulation* Multi-model consensus is an **escalation tool, not a mandatory ritual**. | Stage | When | Method | | --- | --- | --- | | **Default** | All sessions | Single-model deep research | | **Critique Probe** | Medium-stakes decisions | Feed Pass 1 output to a second model for adversarial critique | | **Full Triangulation** | One-Way Doors + Novel Domain + Genuine Contestation | Run identical prompt across 2–3 models; synthesize divergence via ACH matrix | Disagreement is treated as a **diagnostic signal** of problem ambiguity, not a vote to average out. > **Note:** **Evidence:** E-005 (Kim et al. ICML 2025, 60% correlated errors), E-006 (Gao & Xiao, model house styles), E-007 (Lorenz et al. crowds breakdown) ### P8: Structured Falsification & Diagnostic Review Architectural analysis must prioritize **falsification over confirmation**. - Research prompts must explicitly seek disconfirming evidence against favored options. - Decision records must document rejected alternatives with causal rationale. - Every locked ADR must carry a `review_trigger` — explicit conditions or dates for mandatory re-evaluation. - One-Way Doors require a **Gary Klein Premortem** before commitment. - Every One-Way Door ADR should carry a `review_date` set BEFORE the outcome is known, and an optional `prediction` field recording the expected outcome. Post-project retrospectives compare predictions to actuals — without this closing loop, decision calibration can never improve over time. > **Note:** **Evidence:** E-028 (Mitchell, Russo & Pennington 1989 prospective hindsight, 30% risk identification improvement; popularized as the Premortem by Klein 2007), Heuer's ACH, Annie Duke decision journaling ## Pipeline Architecture ### 3.1 Topology: Constrained DAG with Adaptive Checkpoints Vivechak v0.1.0 replaces rigid stage gating with a **Directed Acyclic Graph** governed by explicit information dependencies. #### The Inverted Dependency Default Every research session defaults to **unblocked** (eligible to execute immediately) unless an explicit hard information dependency is declared. #### Dependency Classification | Type | Definition | Effect | | --- | --- | --- | | **Hard (Information)** | Session B literally cannot formulate valid outputs without an artifact from Session A | Blocks execution — DAG edge | | **Soft (Contextual)** | Session B benefits from terminology or constraints from Session A | No blocking — inject a Shared Context Brief (a concise summary of relevant terminology, constraints, and preliminary findings from upstream sessions, included in the prompt's BRIEF block) | #### Dependency Injection Protocol When injecting upstream session outputs as context for downstream sessions: 1. **Extract only the specific information** declared in the dependency specification — typically 3–5 sentences summarizing the relevant decision, finding, or constraint. 2. **Do NOT attach full research artifacts** as context. A 10,000-word research report should be condensed to the specific findings the downstream session needs. 3. **Label the dependency type** in the downstream prompt: - **Constrains:** The upstream decision must be respected (e.g., "Database: PostgreSQL 16 — this is a locked One-Way Door decision") - **Informs:** The upstream finding provides context but should not limit independent evaluation (e.g., "Prior research found latency under 50ms at current scale — verify independently") 4. **Minimizing dependencies maximizes parallelism.** Most Layer 0 and many Layer 1 sessions can run concurrently. Reserve hard dependencies for genuine information prerequisites. 5. **Context Injection Slots:** In automated orchestration (MCP server), prompt templates include explicit slots: - `[UPSTREAM_FINDINGS]`: Injected into downstream session prompts with upstream decisions and evidence. - `[ALL_SESSION_FINDINGS]`: Injected into the final grand synthesis prompt (`SYN-01`) aggregating all completed session findings. #### Adaptive Checkpoints - **Expansion:** If a session reveals unexpected Cynefin-Complex trade-offs, spawn a maximum of 2 child sub-sessions. - **Contraction:** If a planned session's core question has been authoritatively resolved upstream, close it immediately. - **Incremental Synthesis:** Partial FAD compilation begins as soon as any structural branch closes. #### Pipeline Termination Criteria A research pipeline may be terminated early when ALL of the following are met: - Every identified One-Way Door decision has a locked ADR with Grade A/B evidence. - No remaining unexecuted sessions would inform an unresolved One-Way Door. - All executed sessions have produced actionable recommendations (not vague summaries). - No outstanding `contested` corroboration flags remain on critical claims. Termination does NOT require executing every planned session. Two-Way Door sessions that remain unexecuted at termination are decided by convention and logged as Track A decisions. #### Pipeline Failure Modes When a research pipeline encounters problems, apply these recovery protocols: **Session produces garbage (vague summaries, hallucinated citations, off-topic output):** 1. Check the prompt — is the BRIEF clear on WHAT to learn and WHY it matters? 2. Try a different model (Gemini → Claude → ChatGPT). Model strengths vary by domain. 3. If the topic is too broad, split into 2 focused sub-sessions. 4. If the model lacks web access, the output will be parametric recall at best — cap at Grade D and note `verification_method: recalled`. **Synthesis deadlocks (sessions produce contradictory recommendations with equal evidence):** 1. This is expected, not a failure. Use `templates/CONFLICT-RESOLUTION.template.md` — the ACH matrix is designed for exactly this. 2. Check whether the contradiction is real (different evidence) or apparent (different scoping assumptions). 3. If evidence is genuinely equal, classify by reversibility: Two-Way Door → pick either and spike; One-Way Door → escalate to triangulation (run the same prompt on a second model). 4. If deadlock persists after triangulation, the decision may be in the Cynefin Complex domain. Consider a technical spike instead of more research. **Gate reveals gaps (Phase 0 checklist fails on specific items):** 1. Identify which One-Way Doors lack adequate evidence. 2. Spawn targeted follow-up sessions for those specific gaps — do NOT re-run the entire pipeline. 3. If gaps are in Two-Way Door decisions, decide by convention (Track A) and move forward. 4. If gaps indicate the project vision itself is unclear, pause and clarify scope before spawning more sessions. #### Progressive Elaboration Protocol For Tier 2–3 projects where research may span weeks, the project vision may evolve mid-pipeline. When new constraints, pivots, or stakeholder feedback emerge: 1. **Update the RESEARCH-PIPELINE.md** with a dated amendment section noting the change. 2. **Assess impact on existing sessions:** If completed sessions are invalidated, mark their ADRs as deprecated with superseded_by linking to new sessions. 3. **Add or modify sessions** in the DAG to address new concerns. New sessions follow the same tier-appropriate rigor. 4. **Do NOT restart the pipeline from scratch** unless the fundamental project vision has changed (e.g., pivot from B2B to B2C). Incremental amendment preserves completed research investment. This protocol balances research continuity with responsiveness to change — a core tenet of evidence-grounded decision-making. ### 3.2 Adaptive Scaling Model #### 8-Dimension Complexity Scoring (0–24 Points) | Dimension | 0 (Low) | 1 (Moderate) | 2 (Substantial) | 3 (Extreme) | | --- | --- | --- | --- | --- | | **Domain Novelty** | Standard pattern (e.g., CRUD / retail) | Established category (e.g., B2B SaaS, standard protocol) | Unconventional workflow / model | New category / paradigm | | **Technical / Operational Novelty** | Known stack / standard process | Familiar platform, new component | New framework / workflow paradigm | Unproven infra / model | | **Regulatory Exposure** | Zero sensitive data / standard rules | Internal data | PII, GDPR, SOC 2, financial | HIPAA, PCI-DSS, KYC/AML, SEC | | **Reversibility** | Throwaway / easily swapped | Modularly swappable | Core schema / key contracts | Deep platform / legal lock-in | | **Investment Horizon** | Hackathon / weekend spike | Lean MVP / internal tool | Funded venture | Enterprise mission-critical | | **Coordination Complexity** | Single decision-maker | Small team alignment (2–4) | Cross-team / cross-function (5–12) | Multi-org / ecosystem (>12) | | **Expected Longevity** | Days to weeks | Months (prototype) | 1–3 years (product) | 5+ years (platform) | | **Integration Complexity** | Standalone | 1–2 external interfaces (APIs, feeds) | Multiple complex integrations | Regulated rails / legacy systems | #### Tier Mapping | Score | Tier | Session Budget | Character | | --- | --- | --- | --- | | **0–4** | Tier 0: Minimal | 1–3 sessions | Fast spike on core unknown | | **5–9** | Tier 1: Light | 4–8 sessions | Standard SaaS/internal tools | | **10–15** | Tier 2: Standard | 9–16 sessions | Commercial product with core ADRs | | **16–24** | Tier 3: Deep | 17–30 sessions | Novel, regulated, multi-tenant platform | **What constitutes a "session":** A session is one independent research execution — a single prompt sent to a frontier AI model's deep research mode, producing one complete output artifact. Sessions are calibrated for deep research modes that perform 20–100+ web searches per run. If using standard (non-deep-research) chat, a single "session" may require multiple conversational turns to achieve equivalent depth — adjust session budgets accordingly. The tier budgets are relative proportions between tiers, not absolute figures to copy without calibration for your specific tools and workflow. > **Note:** **🚨 Hard Override:** If Regulatory Exposure = 3, all intersecting decisions automatically receive Tier 3 treatment regardless of total score. **Rubric calibration:** The 0–3 scales and tier boundaries are structured heuristics, not calibrated measurement instruments. After completing 2–3 projects, compare the assigned tier to the actual research effort required. If projects consistently need more depth than their tier suggests, adjust boundaries upward. If sessions are routinely closed early because the question was already answered, adjust downward. The rubric should evolve with your team's experience — treat it as a living instrument, not a fixed table. #### Per-Decision Routing Matrix | | **Known Pattern** | **Unknown / Novel** | | --- | --- | --- | | **Reversible (Two-Way Door)** | **SKIP** — decide by convention | **FAST SPIKE** — 1 timeboxed session | | **Irreversible (One-Way Door)** | **CONFIRM & COMMIT** — 1 session + ADR | **DEEP RESEARCH** — 2–5 sessions + ADR + premortem | ### 3.3 Staged Triangulation Protocol | Stage | Trigger | Method | Cost | | --- | --- | --- | --- | | **Default** | All sessions | Single-model deep research | 1× | | **Critique Probe** | Medium-stakes decisions | Feed Pass 1 synthesis to Model B for adversarial critique | 1.3× | | **Full Triangulation** | One-Way Doors + Novel Domain + Genuine Contestation | Run identical prompt on 2–3 models; synthesize divergence via ACH matrix | 3× | ## Research Prompt Design ### 4.1 The 8-Block Prompt Anatomy | Block | Purpose | Prescriptive or Directional? | | --- | --- | --- | | **DECISION** | What architectural decision this feeds, door type (one-way/two-way), reversal condition | **Prescriptive** — anchors session to purpose | | **BRIEF** | Investigation goal, question kind (lookup/causal/evaluative), context, target audience | **Prescriptive** — what and why | | **SCOPE** | Boundaries, time window, in/out scope, source priorities, date anchor | **Prescriptive** — boundaries | | **KNOWN** | Upstream findings slot (`[UPSTREAM_FINDINGS]`) or starting assumptions to stress-test | **Prescriptive** — inherited baseline | | **CALIBRATION** | 5 epistemic calibration rules: memory as hypothesis, honest gaps, expert objections | **Directional** — epistemic discipline | | **APPROACH** | Exploration strategy (DEEPEN, WIDEN, CORROBORATE, FALSIFY, PIVOT), research depth mandate, iterative guidance, domain probes | **Directional** — guide how, don't prescribe | | **DONE** | 3-5 quality-based completion criteria (primary answer, grounded tradeoffs, failure modes, reversal conditions) | **Prescriptive** — definition of done | | **FORMAT** | Single complete Markdown file artifact with YAML frontmatter and standard section flow | **Prescriptive** — output structure | #### What Was Removed and Why | Pre-validation Element | Verdict | Evidence | | --- | --- | --- | | `<system>` expert persona | **Removed** — personas don't improve factual accuracy | Zheng et al. EMNLP 2024; Basil et al. 2025 | | `<web_searches>` hardcoded queries | **Removed** — violates agentic ReAct loop | Yao et al. 2023; OpenAI BrowseComp scaling analysis | | `<bias_resistance>` negative instructions | **Removed** — triggers ironic "white bear" rebound | Documented in T2-06 | | `<output_spec>` rigid sections | **Replaced** with coverage checklist | Tam et al. EMNLP 2024 | | Minimum search counts | **Removed** — artificial floors don't match model judgment | T1-02 | | Multi-turn drip-feeding | **Banned** — front-load everything in one turn | Laban et al. ICLR 2026 (39% drop) | ### 4.2 Standard Prompt Template ```markdown # RESEARCH BRIEF: [Topic Title] ## DECISION [Neutral decision question]; informs [D-NNN: Title]. Door: [one-way | two-way]. What would change the recommendation: [reversal condition]. ## BRIEF We are investigating [core technical/architectural question]. Question type: [lookup | causal | evaluative]. This research will directly inform Architectural Decision [D-NNN: Title]. The target audience is a Principal Architect requiring rigorous, production-grade technical evaluation with concrete tradeoffs, operational failure modes, and verified benchmarks — not high-level introductory summaries. Context (requester-stated, unverified): [context]. ## SCOPE - **Temporal Anchor:** Today's date is [YYYY-MM-DD]. Focus on developments within the last 18–24 months. Flag findings older than [date] as potentially stale. - **In Scope:** [Explicit boundary 1], [boundary 2], [boundary 3]. - **Out of Scope:** [Explicit exclusion 1], [exclusion 2]. - **Source Priorities:** Prioritize primary sources (official docs, RFCs, source code, peer-reviewed benchmarks) over secondary aggregators, blogs, and vendor claims. ## KNOWN [UPSTREAM_FINDINGS] — treat inherited claims as assumptions to stress-test, not settled facts. Key assumptions this session starts with (requester-stated, unverified): [assumptions]. ## CALIBRATION 1. Treat your memory as a hypothesis to test. Note initial beliefs; report what evidence confirmed, updated, or contradicted. 2. A significant claim is most valuable when grounded with a verifiable source. "Not found after searching X, Y, Z" is a valid, valued result. 3. An unsupported claim presented as fact costs more than an honest gap. 4. Before finishing: state the strongest objections an expert would raise and what evidence you found for or against each. 5. Distinguish what you found from what you recalled. Mark recalled claims honestly — they are starting points, not conclusions. ## APPROACH Use the research move that fits each question: - DEEPEN: trace a claim to its primary source - WIDEN: search with different vocabulary or source types - CORROBORATE: find independent support for a load-bearing claim - FALSIFY: actively search for evidence against your leading answer - PIVOT: reframe the question when results suggest the framing is wrong - Do NOT limit yourself to the exact terms in the research question. Use ALLIED TERMS: synonyms, competitor names, failure modes, edge cases. - Execute MULTIPLE SEARCH STRATEGIES per finding: Direct, Adversarial, Comparative, Community. - Target 8-12 SUBSTANTIVE findings with evidence grades, not 20 shallow bullet points. - For every recommendation, search for the STRONGEST ARGUMENT AGAINST it. - If your research reveals critical concerns beyond the stated scope, investigate and include them. ## DONE This session is complete when: 1. A recommendation is stated with evidence for the primary question. 2. Tradeoffs and options are evaluated with verifiable evidence citations. 3. At least one concrete failure mode per top contender is documented with the strongest disconfirming evidence found. 4. "What would change this recommendation" is answered with specific reversal triggers. 5. Discovered Concerns (if research revealed material concerns beyond stated scope). ## FORMAT Single Markdown file with YAML frontmatter (id, title, date, status, topic, tags, informs_decisions, confidence). Sections: Prior (pre-research beliefs: 3-5 checkable propositions "I believe [X] because [reasoning]") → Research Question → Key Findings (3-7 bullets) → Recommendation (isolated from rejected options) → Alternatives Considered → Detailed Findings → Open Questions & Risks → Delta (what research changed: table with Prior Belief | Status | Evidence | Impact) → Sources & Evidence Ledger. Filename: [Session-ID]-[slug].md ``` ### 4.3 Research Output Quality Rubric A research session output meets Vivechak's quality bar when it satisfies ALL of the following: | Criterion | Minimum Standard | | --- | --- | | **Evidence Density** | ≥3 distinct claims backed by Grade A or B evidence | | **Options Evaluated** | ≥2 competing options analyzed for comparison sessions | | **Failure Modes** | ≥1 concrete failure scenario identified per recommended option | | **Reversal Triggers** | Explicit conditions for when to re-evaluate the recommendation | | **Source Diversity** | Not all evidence from a single vendor or source | | **Disconfirming Evidence** | At least one actively sought disconfirming argument documented | Sessions failing this rubric should be re-executed with a refined prompt before their findings inform ADRs. ## Evidence & Decision System ### 5.1 Evidentiary Tiers (A through E) | Grade | Label | Description | Allowed Provenance | Gate Impact | | --- | --- | --- | --- | --- | | **Grade A** | Primary Empirical | Official specifications, canonical source code, RFCs, or primary documentation with explicit URL anchor. | `fetched, human-provided` | G6, G7 | | **Grade B** | Secondary Empirical | Peer-reviewed papers, reproducible third-party benchmarks, published postmortems, or corroborated engineering reports. | `fetched, cached` | G6, G7 | | **Grade C** | Vendor & Practitioner | Vendor marketing, product whitepapers, vendor benchmarks, conference talks, or interested-party documentation. | `fetched, cached` | Advisory | | **Grade D** | Informal & Opinion | Blog posts, forum discussions, StackOverflow answers, or model memory recall (capped at Grade D). | `fetched, cached, recalled` | Advisory | | **Grade E** | Speculative & Unsubstantiated | Unverified hypotheses, uncorroborated parametric recall, or ungrounded assertions. | `recalled, unverified` | Advisory | *Rule*: Parametric memory recall is capped at **Grade D**. Grade A requires canonical URL or specification anchor. *Gate*: G6 counts Grade A/B claims that sit on a line with their URL, written as the composite citation (§5.5), a bracketed grade tag (`[A · single · fresh · direct · fetched](url)`, `[Grade A: url | fetched]`) or an evidence-ledger row whose Grade cell is A or B; G7 counts those whose verification label is exactly `fetched` or `human-provided` (§7.2). ### 5.2 Contextual Modifiers | Modifier | Values | Purpose | | --- | --- | --- | | **Corroboration** | `single` · `corroborated` (≥2 independent sources) · `contested` (direct contradiction) | How many sources agree? | | **Recency** | `fresh` (within domain half-life) · `aging` (approaching half-life) · `stale` (past half-life) | Is this current? | | **Directness** | `direct` (exact workload/target) · `indirect` (analogical evidence) | Does this apply to our case? | **Domain Half-Life Guidance:** The threshold between `fresh` and `aging` varies by domain: - Cloud pricing and provider features: ~6 months - Framework/library APIs and benchmarks: ~12 months - Security advisories and CVEs: ~3 months - Database internals and query optimizers: ~18 months - Regulatory requirements (GDPR, HIPAA, PCI): ~24 months - Foundational CS/architecture principles: ~5+ years When in doubt, treat evidence as `aging` rather than `fresh`. ### 5.3 Verification Method | Method | Definition | Grade Cap | | --- | --- | --- | | `fetched` | Retrieved and validated live via tool/web call during this session | None | | `cached` | Read from local repository file or previously verified artifact | None | | `recalled` | Generated from model parametric memory without live verification | **Capped at Grade D** | | `secondhand` | Sourced from an article summarizing a primary source | None | | `human-provided` (or `human`) | Injected directly by a human engineer | None | ### 5.4 Hard Rules 1. **Recalled claims capped at Grade D** regardless of apparent source quality. 2. **Zero recalled citations may underpin One-Way Door decisions.** Every One-Way Door decision needs at least two Grade A/B claims with URLs whose verification is `fetched` or `human-provided` (gate rule G7); `cached` and `secondhand` claims may support it but do not count. 3. **Contested claims must be surfaced, not resolved by majority.** Document the contradiction and causal resolution reasoning. ### 5.5 Composite Citation Format ```markdown Claim text (Grade [A-E] · [corroboration] · [recency] · [directness] | [verification_method]) ``` Example: ```markdown PostgreSQL 16 logical replication supports bi-directional failover. (Grade B · corroborated · fresh · direct | fetched) ``` ### 5.6 Decision Confidence (Decoupled from Evidence Grade) | Confidence | Definition | | --- | --- | | `high` | Multiple corroborated Grade A/B sources; alternatives thoroughly evaluated | | `medium` | Adequate evidence but some alternatives lack evaluation, or key claims rest on single sources | | `low` | Decision under uncertainty; thin, contested, or indirect evidence | ### 5.7 Architecture Decision Records (D-NNN) Every architectural decision is documented as a YAML-frontmattered Markdown file: ```yaml --- id: D-001 title: "Primary Datastore Selection" status: accepted # proposed | accepted | rejected | deprecated | superseded door_type: one-way # Sets evidentiary bar date: 2026-08-18 confidence: high # Decoupled from evidence grade evidence_refs: [E-012, E-047] informed_by_sessions: [T2-03, T2-05] supersedes: null superseded_by: null amends: null review_trigger: "Re-evaluate if ingestion exceeds 50k ops/sec or storage >2TB" review_date: 2027-02-18 # Set BEFORE outcome is known prediction: "PostgreSQL will handle projected load for 18+ months" tags: [datastore, infrastructure] authored_by: "agent-vivechak" human_reviewed: true # Mandatory for one-way doors schema_version: "0.1.0" --- ``` **Required body sections:** 1. Context & Problem Statement 2. Evaluated Options (with evidence references) 3. Decision Outcome & Rationale 4. Rejected Alternatives & Tradeoffs 5. Failure Modes & Reversal Triggers ## Output Architecture ### 6.1 Hybrid Markdown + YAML Frontmatter Every research artifact combines: - **YAML frontmatter** — machine-parseable metadata - **Markdown body** — human-readable narrative with standardized section structure - **Strict separation** between `Recommendation` and `Alternatives Considered` ### 6.2 Standardized 9-Section Body Skeleton | # | Section | Purpose | | --- | --- | --- | | 1 | `## Prior` | Pre-research assumptions and starting beliefs (mitigates confirmation bias) | | 2 | `## Research Question` | Precise 1–2 sentence statement of inquiry | | 3 | `## Key Findings` | 3–7 atomic bullet points with inline evidence grades extractable by synthesis agents | | 4 | `## Recommendation` | Explicit guidance (isolated from rejected options, referencing evidence) | | 5 | `## Alternatives Considered` | Evaluated competing options and rejection rationale | | 6 | `## Open Questions & Risks` | Unresolved items, dependencies, and downstream risks | | 7 | `## Discovered Concerns` | Unexpected constraints, trade-offs, or failure modes outside initial scope (≥50 chars for one-way doors) | | 8 | `## Delta` | Tracking shift from prior beliefs (Confirmed / Contradicted / Updated) | | 9 | `## Sources & Evidence Ledger` | Tabular citations with composite grade, verification method, and claimed provenance | ### 6.3 Map-Reduce Synthesis Workflow When synthesizing research sessions into the Founding Architecture Document: ```yaml --- id: SYN-01 title: "[Project Name] — Founding Architecture Document" synthesis_date: YYYY-MM-DD status: draft # draft | sealed research_sessions_ingested: 0 # Count of final sessions ingested decisions_locked: 0 # Count of accepted ADRs open_questions: 0 # Count of unresolved questions schema_version: "0.1.0" --- ``` 1. **Filter:** Ingest only `status: final` sessions 2. **Group:** Cluster by `topic` tags 3. **Map:** Extract atomic Key Findings and Recommendation sections 4. **Reduce:** Merge topic clusters into unified subsystem chapters 5. **Reconcile:** Resolve cross-session contradictions using confidence + date weighting 6. **Trace:** Annotate all FAD blocks with originating session and ADR IDs 7. **Gate:** Subject to Track B Phase 0 Gate before committing #### 6.3.1 FAD Versioning and Post-Seal Updates Once sealed, a FAD is immutable. When a `review_trigger` fires or new evidence invalidates a locked ADR: 1. **Open a new research session** targeting the specific decision under review. 2. **Record a new ADR** (D-NNN+1) with `supersedes: D-NNN` linking to the original. 3. **Issue a FAD Amendment** (SYN-01.1, SYN-01.2, etc.) documenting only the changed sections with full traceability. 4. **Re-run the Phase 0 Gate** for the amended decision only. Do NOT modify the original sealed FAD. Amendments are additive documents that reference the sealed original. ### 6.4 Weighted Evaluation Protocol (Comparison Sessions) When a research session involves comparing multiple options (e.g., database selection, framework evaluation, vendor comparison), the qualitative analysis must be complemented by a **quantitative weighted scoring matrix** to counteract narrative volume bias — the systematic tendency of AI models to favor options with more training data, blog coverage, and community advocacy regardless of project-specific fit. #### Why This Matters Qualitative-only comparison is vulnerable to three documented biases: - **Narrative volume bias:** Technologies with larger communities produce more positive text, creating an illusion of superiority that reflects popularity, not fitness. - **Verbosity bias:** Models prefer longer, more detailed responses — well-documented options get richer analysis, which reads as stronger evidence. - **Vendor marketing contamination:** Well-funded products produce Grade C evidence (vendor claims) at scale, drowning out Grade A/B evidence for alternatives. Weighted scoring forces the model to evaluate each option against explicit, project-derived criteria rather than relying on narrative coherence. #### Protocol For any session that evaluates 2+ competing options: 1. **Derive Criteria from Project Context:** Extract 5–8 evaluation criteria directly from the project vision and the decision being informed. Do not use generic criteria — every criterion must trace to a specific project requirement or constraint. 2. **Assign Weights (must sum to 1.0):** Weight each criterion by its importance to this specific project. Justify each weight with a one-line rationale. Example: | Criterion | Weight | Rationale | |---|---|---| | Write throughput at scale | 0.25 | Core use case: high-volume event ingestion | | Operational complexity | 0.20 | Solo developer, no dedicated DevOps | | Query flexibility | 0.20 | Ad-hoc analytics required by product spec | | Ecosystem maturity | 0.15 | Long-term maintenance, not greenfield research | | Cost at projected scale | 0.10 | Bootstrap budget, cost-sensitive first 18 months | | Migration path | 0.10 | Two-way door if wrong, but migration still has cost | 3. **Score Each Option (1–5 scale):** Score every option against every criterion using this scale: - **5:** Exceptional fit, clear leader on this criterion (with evidence) - **4:** Strong fit, minor gaps - **3:** Adequate, meets minimum requirements - **2:** Weak, notable gaps or concerns - **1:** Poor fit, significant risk or missing capability Each score must reference the specific evidence (E-NNN or inline citation) that justifies it. Scores without evidence references are invalid. 4. **Compute Weighted Totals:** Multiply each score by its weight and sum across criteria. 5. **Sensitivity Check:** Identify the top 2 criteria by weight. Re-run the calculation with those weights shifted ±20%. If the ranking changes, flag the recommendation as **weight-sensitive** and note which criteria drive the instability. 6. **Synthesize:** The final recommendation must consider BOTH the weighted score AND the qualitative analysis. The score is a **bias-correction lens**, not the sole decision input. If qualitative analysis and scoring disagree, explicitly address the divergence and explain which signal the recommendation follows and why. #### Important Constraints - This protocol applies ONLY to comparison sessions. Landscape scans, single-technology deep dives, and blueprint sessions do not require scoring. - The weighted score is a complement to qualitative analysis, never a replacement. Architectural decisions involve judgment dimensions (team culture, strategic direction, ecosystem trajectory) that resist quantification. - Criteria selection itself can introduce bias. The model must justify WHY these criteria and not others. ## Phase 0 Exit Gate ### 7.1 The Two-Track Standard | Track | Applies To | Requirements | Speed | | --- | --- | --- | --- | | **Track A: Fast-Track** | Two-Way Door decisions | Decision logged, reversibility confirmed, single corroborated source | Minutes | | **Track B: Rigorous Gate** | One-Way Door decisions | Pre-codebase exit gate (Rules G1–G11) + Gary Klein Premortem | Hours–Days | ### 7.2 Track B: Pre-Codebase Exit Checklist (Rules G1–G11) 1. **DAG Closure (G1/G2)** — All planned dependency sessions terminated in `status: complete` 2. **Contradiction Resolution** — All divergences explicitly resolved 3. **Evidentiary Threshold (G6)** — ≥2 Grade A/B claims, each on a line with its URL, across the ADR and the sessions that inform it: the composite citation (§5.5), a bracketed grade tag such as `[A · single · fresh · direct · fetched](url)` or `[Grade A: url | fetched]`, or an evidence-ledger row whose Grade cell is A or B. Uncorroborated Grade C/D/E claims must not underpin irreversible pillars 4. **Verification Integrity (G7)** — of the claims G6 counts, ≥2 carry the verification label `fetched` or `human-provided` (`human`), read exactly from the tag's last field or the ledger row's Verification cell; `cached`, `secondhand`, `recalled`, `verified` and `unverified` do not count. Labels are as reported by the agent; Vivechak does not fetch or verify sources 5. **No Placeholders & Alternatives Documented (G8)** — Every ADR includes evaluated and rejected options with substantive tradeoffs and zero placeholder stubs 6. **Decay Triggers Assigned (G9)** — Every ADR contains explicit, measurable `review_trigger` 7. **Adversarial Red-Team Challenge (G10)** — One-Way Door decisions subjected to adversarial stress testing with cited challenge record (`D-NNN-R1.md`) before commitment 8. **Human Review (G11)** — Named Principal Architect signature on all One-Way Door ADRs (`human_reviewed: true` via `vck signoff`) 9. **FAD Sealed (G3)** — Founding Architecture Document compiled, committed, ready for scaffolding 10. **Decision Traceability & Locked Status (G4/G5)** — All referenced decisions have corresponding ADRs locked in accepted or superseded status 11. **Premortem Protocol** — Gary Klein prospective hindsight: *"Assume catastrophic failure in 12 months. What caused it?"* ## Generator Architecture The pipeline generator uses a **deterministic/AI hybrid** architecture that produces two documents: a unified pipeline containing the execution plan and copy-paste-ready research prompts, plus a separate decision registry that evolves during execution. See [GENERATOR-PROJECT.md](GENERATOR-PROJECT.md) for the working generator prompt. The long-term vision is a 5-layer code-based tool: | Layer | Function | Implementation | | --- | --- | --- | | **0: Input** | Collect project vision via open-ended description | AI — parameter extraction from natural language | | **1: Classification** | 6-archetype domain classifier + 8-dimension complexity scoring | Deterministic — rule-based decision tree | | **2: Skeleton** | Assemble session matrix from archetype templates + tier budget | Deterministic — template composition | | **3: Prompt Synthesis** | Generate project-specific prompt prose for each session slot | AI — N parallel scoped calls | | **4: Registry Seeding** | Generate project-specific D-NNN hypotheses | AI — scoped calls tied to vision + constraints | | **5: Validation** | Schema validation, archetype completeness, budget verification | Deterministic — CI-style gates | ### The 6 Domain Archetypes | Archetype | Unique Research Needs | | --- | --- | | **B2B SaaS** | Multi-tenancy, RBAC/SAML, CRM integrations, seat/usage pricing | | **Developer Tools** | DX & time-to-first-value, CLI/SDK idioms, open-source licensing | | **FinTech** | KYC/AML, banking rails, immutable ledgers, PCI-DSS, fraud detection | | **AI/ML Systems** | Model selection, eval benchmarks, inference cost, context architecture | | **Consumer Mobile** | App Store compliance, offline-first sync, push/retention, in-app billing | | **Real-Time / IoT** | MQTT/WebSockets, edge vs cloud compute, fleet OTA, hardware constraints | #### Beyond Software: Domain Adaptation Vivechak's epistemic core — evidence grading (Admiralty-Code-derived source grading with GRADE-inspired modifiers), ACH conflict resolution (CIA/Heuer), premortem protocol (Gary Klein), reversibility routing (Bezos Type 1/2 doors), and map-reduce synthesis — was not invented for software. These primitives govern how intelligence reasons about truth, risk, and irreversibility in *any* domain. The generator prompt already uses "technical project" rather than "software project." The 6 operational templates (Decisions, Conflict Resolution, Comparison Session, FAD, Phase 0 Gate, Session Note) contain zero software-specific content. Non-software domains have been successfully researched using adapted versions of the generator. **To adapt for a non-software domain:** 1. The 8 core principles, evidence grading, and all templates work without modification. 2. Add domain-specific archetypes to the generator (equivalent to the 6 software archetypes above). Each archetype defines the unique research needs for that domain. 3. Adapt the complexity scoring rubric labels — replace software-specific terms ("Standard CRUD," "New library") with domain-equivalent complexity indicators. 4. Adjust the APPROACH block's target audience — replace "Principal Architect" with the domain-equivalent decision-maker. #### Archetype Maintenance Archetypes are versioned data, not finished code. Domain research needs shift as technology and regulations evolve. Each archetype should be treated as a living reference: - Review archetypes after every 2–3 projects that use them. - If a project required significant ad-hoc adaptation beyond its assigned archetype, consider whether a new archetype is warranted. - If the generator's fallback path (projects that don't fit any archetype) triggers frequently, that's a signal a new archetype is needed — not evidence the fallback is working. ## Multi-Scope Research Vivechak operates at three scope levels. Scope and depth are **independent axes** — a comparison can be shallow or deep; a project can be Tier 0 or Tier 3. The scope level determines the entry point, output shape, and which methodology mechanisms apply; the depth determines how many sessions and how much evidence is required. ### 9.1 The Three Scope Levels | Scope | Entry Point | Sessions | Output | When to Use | | --- | --- | --- | --- | --- | | **Project** | `GENERATOR-PROJECT.md` | Tier-determined (1–30) | Full pipeline → FAD | New project, major pivot, or system-wide re-evaluation | | **Decision** | `GENERATOR-DECISION.md` | 1–3 (capped; escalate if more) | Research plan + proposed ADR | Single architectural decision, standalone or mid-project | | **Comparison** | `GENERATOR-COMPARISON.md` | 1 (always) | WEP comparison matrix | Bounded comparison of 2–5 named options | **Scope selection is the user's choice**, not an automatic classification. The generators include guards (SCOPE CHECK, ESCALATE) that flag when a chosen scope may be insufficient, but never block output. ### 9.2 Methodology Invariants (I1–I9) These rules hold at **every** scope level. They are the shared methodology kernel — the text that must stay byte-identical across all three generators. | # | Invariant | Source | How It Carries | | --- | --- | --- | --- | | **I1** | Bounded Exploration Mandate — stated scope is a coverage floor, not a ceiling | P4 | Verbatim instruction in APPROACH block | | **I2** | Evidence grading: A–E base + corroboration/recency/directness modifiers + verification method; recalled capped at Grade D | §5.1–5.4 | Verbatim grading legend in DELIVERABLE block | | **I3** | 8-block prompt anatomy: DECISION → BRIEF → SCOPE → KNOWN → CALIBRATION → APPROACH → DONE → FORMAT | §4.1 | Structural template in every emitted prompt | | **I4** | Audience framing, not persona assignment — quality bar, not role-play | P4 | BRIEF block: "a principal architect needing production-grade tradeoffs" | | **I5** | 7-section output skeleton; Recommendation isolated from Alternatives Considered | P6, §6.2 | FORMAT block | | **I6** | Weighted Evaluation Protocol (WEP) for any session comparing 2+ options | §6.4 | DELIVERABLE block in C-role and comparison prompts | | **I7** | Structured falsification: seek disconfirming evidence; premortem for one-way doors | P8 | APPROACH block + F-role sessions | | **I8** | Door-type test (Bezos one-way/two-way) | P2 | Classification step in decision generator; SCOPE CHECK in comparison generator | | **I9** | No drip-fed instructions — front-load the complete brief in one turn | P4 | All generators emit single, self-contained prompts | ### 9.3 Decision Routing (Decision Scope) At decision scope, the 8-dimension project complexity score is replaced by a 4-dimension **R/N/B/X profile** scored 0–3: | Dimension | 0 | 1 | 2 | 3 | | --- | --- | --- | --- | --- | | **R** Reversal cost (against current STAGE) | Flag flip | Module swap | Data/contract migration | Rewrite/external commitment | | **N** Novelty (higher of domain and technical) | Team standard | New to team | Unconventional/fast-moving | Unproven | | **B** Blast radius | One module | One subsystem | Several subsystems/dependent decisions | Whole product/external contracts | | **X** Regulatory | None | Internal data | PII/GDPR/SOC2 | HIPAA/PCI/KYC/children | **Classification:** One-way door if R≥2 or B=3. Novel if N≥2. Hard override: X=3 forces DEEP RESEARCH. **Routing matrix** (same 4 lanes as §3.2): | | Known (N<2) | Novel (N≥2) | | --- | --- | --- | | **Two-way** (R<2 and B<3) | SKIP — ADR skeleton + 1 optional prompt | FAST SPIKE — 1 session | | **One-way** (R≥2 or B=3) | CONFIRM & COMMIT — 1 session | DEEP RESEARCH — 2–3 sessions | **Session roles:** L (Landscape — maps the option space), C (Comparison — WEP evaluation), F (Falsify — premortem and failure analysis). Hard cap of 3 sessions; if more are needed, escalate to project scope. ### 9.4 Scope Boundaries and Guards | Guard | Location | Behavior | | --- | --- | --- | | **SCOPE CHECK** | Comparison generator | Detects one-way doors, sensitive data, yes/no framing, incomplete option lists. Adds "Use the decision-level generator" but still writes the comparison prompt. | | **ESCALATE** | Decision generator | Fires when >3 sessions would be needed or the context contains multiple coupled decisions. Outputs "ESCALATE: use the project-level generator" with the sub-decisions listed. | | **Adjacent decisions** | Decision generator | Lists up to 3 noticed adjacent decisions (one line each) rather than absorbing them into the current scope. | ### 9.5 What Changes Between Scopes Four project-level mechanisms are **correctly omitted** below project scope: 1. **8-dimension / 0–24 project complexity score and tier mapping** — replaced by R/N/B/X at decision scope; absent at comparison scope. 2. **6-archetype classifier** — meaningless for a single decision or comparison. 3. **DAG session-matrix construction** — a decision has at most 3 sessions in a simple dependency shape; a comparison has exactly 1. 4. **"Add sessions for concerns the user didn't mention"** — replaced by "list adjacent decisions, don't absorb them" at decision scope, and SCOPE CHECK redirect at comparison scope. ## Composition Strategy Replace fixed compose/build ratios with Wardley evolution mapping: | Evolution Stage | Strategy | Examples | | --- | --- | --- | | **Commodity/Utility** | 100% compose | Auth, DB, Storage, Queues, UI primitives | | **Product** | Evaluate compose vs customize | CMS, analytics, email, payments | | **Custom** | Extend/fork existing tools | Specialized dashboards, domain UI patterns | | **Genesis** | 100% custom build | Core algorithms, domain state machines, business logic | ## Specification Provenance This framework was produced by applying Vivechak to itself: - **11 independent research sessions** across frontier AI platforms - **31 evidence nodes** from peer-reviewed studies, industry standards, and empirical benchmarks - **10 hypothesis verdicts** — 0 fully validated as-is, 3 refuted, 5 refined, 2 validated with enhancements The complete evidence base is preserved in [docs/meta-research/](docs/meta-research/). The framework is fully self-contained without it.