Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@tienne/gestalt

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tienne/gestalt

TypeScript AI Development Harness - Gestalt psychology-driven requirement clarification

npmnpm
Version
0.20.1
Version published
Weekly downloads
1.8K
131.28%
Maintainers
1
Weekly downloads
 
Created
Source

Gestalt

Gestalt — AI Development Harness
Turn vague requirements into structured, executable plans — right inside Claude Code.

npm version MIT License CI

한국어

Gestalt is an MCP (Model Context Protocol) server that runs inside Claude Code. It conducts a structured requirement interview, generates a validated Spec — a JSON document capturing your goal, constraints, and acceptance criteria — and transforms that Spec into a dependency-aware execution plan.

Claude Code acts as the LLM throughout. Gestalt manages state, validates results, and advances the pipeline. No API key required.

Requires Node.js >= 20.0.0. Use nvm install 22 && nvm use 22 if needed.

Contents

Quick Start

Install the plugin once, then use it in any Claude Code session.

From a terminal (outside a session):

claude plugin install gestalt@gestalt

Inside a Claude Code session:

/plugin marketplace add tienne/gestalt
/plugin install gestalt@gestalt

Then run the pipeline:

/interview "user authentication system"
/spec
/execute

Full MCP Reference — all tools, parameters, and examples

How It Works

Vague requirements are the primary cause of implementation drift. When the goal isn't precise, Claude fills gaps with assumptions — and those assumptions diverge from intent as the project grows.

Gestalt addresses this before any code is written. It runs a structured interview guided by five Gestalt psychology principles to raise requirement resolution to a measurable threshold (≥ 0.8). The result is a Spec: a validated JSON document that drives every subsequent step.

The Five Gestalt Principles

PrincipleRole
ClosureFinds what's missing; surfaces implicit requirements
ProximityGroups related features and tasks by domain
SimilarityIdentifies repeating patterns across requirements
Figure-GroundSeparates MVP (figure) from nice-to-have (ground)
ContinuityValidates dependency chains; detects contradictions

Passthrough Mode

Gestalt runs as an MCP server. Claude Code acts as the LLM: Gestalt returns prompts and context, and Claude Code does the reasoning. The server makes no API calls.

Note: The Execute stage always runs in Passthrough mode, regardless of whether an API key is configured. Execute carries out real file edits and code execution through Claude Code's tools (Bash, Edit, etc.), so Claude Code must be the LLM that drives it — this is by design, not a missing feature.

You (in Claude Code)
       │
       ▼  /interview "topic"
  Gestalt MCP Server
  (returns context + prompts)
       │
       ▼
  Claude Code executes the prompts
  (generates questions, scores, plans)
       │
       ▼
  Gestalt MCP Server
  (validates, stores state, advances)
       │
       ▼  repeat until resolution ≥ 0.8
  Final Spec → Execution Plan

Installation

Bundles the MCP server, slash-command skills, Gestalt agents, and project context — pre-configured in a single install.

From a terminal:

claude plugin install gestalt@gestalt

Inside a Claude Code session:

/plugin marketplace add tienne/gestalt
/plugin install gestalt@gestalt

What you get:

ItemDetails
MCP Toolsges_interview, ges_generate_spec, ges_execute, ges_create_agent, ges_agent, ges_status, ges_code_graph, ges_graph_visualize, ges_benchmark, ges_generate_kb, ges_search, ges_sync
Slash Commands/interview, /spec, /execute, /agent
Agents5 pipeline agents + 9 Role agents + 3 Review agents
CLAUDE.mdProject context and MCP usage guide auto-injected

Option 2: Claude Code Desktop

Add this to your settings.json (or claude_desktop_config.json) and restart:

{
  "mcpServers": {
    "gestalt": {
      "command": "npx",
      "args": ["-y", "@tienne/gestalt"]
    }
  }
}

MCP tools are available immediately after restart. Slash commands require the plugin or manual skills setup.

Option 3: Claude Code CLI

claude mcp add gestalt -- npx -y @tienne/gestalt

Or add directly to ~/.claude/settings.json:

{
  "mcpServers": {
    "gestalt": {
      "command": "npx",
      "args": ["-y", "@tienne/gestalt"]
    }
  }
}

Option 4: OpenAI Codex CLI

codex mcp add gestalt -- npx -y @tienne/gestalt serve

Then add "client": "codex" to your project's gestalt.json so the active session context is written to AGENTS.md (which Codex reads automatically):

{
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
  "client": "codex"
}

Or set GESTALT_CLIENT=codex as an environment variable.

All 12 MCP tools (ges_interview, ges_generate_spec, ges_execute, etc.) are available immediately. Slash commands and the Claude Code Task panel are not available in Codex — the pipeline runs entirely through MCP tool calls.

Option 5: Google Gemini CLI

gemini mcp add gestalt -- npx -y @tienne/gestalt serve

Or add directly to ~/.gemini/settings.json:

{
  "mcpServers": {
    "gestalt": {
      "command": "npx",
      "args": ["-y", "@tienne/gestalt", "serve"]
    }
  }
}

Then add "client": "codex" to your project's gestalt.json — Gemini CLI reads AGENTS.md for persistent context, same as Codex:

{
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
  "client": "codex"
}

Use the /mcp command inside a Gemini CLI session to verify the server is connected.

The Pipeline

1. Interview

Start with any topic. A rough sentence is enough.

/interview "I want to build a checkout flow with Stripe"

Gestalt conducts a multi-round interview. Each round targets a specific resolution dimension:

  • Closure — What's missing? What did you assume but not say?
  • Proximity — Which features belong together?
  • Similarity — Are there repeating patterns across requirements?
  • Figure-Ground — What's the core MVP vs. what's optional?
  • Continuity — Any contradictions or conflicts?

The interview continues until the resolution score reaches ≥ 0.8:

Round 1 → resolution: 0.28  (lots of unknowns)
Round 4 → resolution: 0.55  (getting clearer)
Round 8 → resolution: 0.81  ✓ ready for Spec

Context Compression

When rounds exceed 5, Gestalt signals that compression is available. Use the compress action to summarize earlier rounds and keep the context window lean:

1. respond returns needsCompression: true + compressionContext
2. ges_interview({ action: "compress", sessionId }) → compressionContext
3. Caller generates summary → submits it → stored in session

The compressed summary is automatically injected into all subsequent rounds.

2. Spec Generation

From a completed interview:

/spec

From text (no interview required):

ges_generate_spec({ text: "Build a checkout flow with Stripe" })

With a built-in template:

Template IDDescription
rest-apiREST API with auth, CRUD, and OpenAPI
react-dashboardReact dashboard with charts, filters, and responsive layout
cli-toolCLI with subcommands, config file, and distribution
ges_generate_spec({ text: "API with JWT authentication", template: "rest-api" })

The generated Spec includes:

goal                → Clear, precise project objective
constraints         → Technical and business constraints
acceptanceCriteria  → Measurable, verifiable success conditions
ontologySchema      → Entity-relationship model
gestaltAnalysis     → Key findings per Gestalt principle

3. Execute

Transform the Spec into a dependency-aware execution plan and run it:

/execute

Execute always runs in Passthrough mode — Claude Code performs the actual file edits and code execution through its tools (Bash, Edit, etc.). Configuring an API key does not switch Execute to a self-contained LLM mode; there is no such mode by design.

Planning applies four Gestalt principles in a fixed sequence:

StepPrincipleWhat it does
1Figure-GroundClassifies acceptance criteria as critical vs. supplementary
2ClosureDecomposes ACs into atomic tasks, including implicit ones
3ProximityGroups related tasks by domain
4ContinuityValidates the dependency DAG — no cycles, topological order confirmed

Execution runs tasks in topological order. After each task, drift detection checks alignment with the Spec:

  • 3-dimensional score: Goal (50%) + Constraint (30%) + Ontology (20%)
  • Jaccard similarity measurement
  • Auto-triggers a retrospective when drift exceeds the threshold

Parallel Execution

The plan_complete response includes parallelGroups: string[][]. Tasks with no mutual dependencies are placed in the same group and can run concurrently:

"parallelGroups": [
  ["setup-db", "setup-env"],
  ["create-schema"],
  ["seed-data", "run-tests"]
]

Resuming an Interrupted Session

ges_execute({ action: "resume", sessionId: "<id>" })

Returns ResumeContext: completed task IDs, next task, and progressPercent. The ges_status response also includes resumeContext automatically for any active session.

Brownfield Audit

When a codebase already exists, audit it against the Spec before running new tasks:

# Step 1: request audit context
ges_execute({ action: "audit", sessionId: "<id>" })
# → returns auditContext (systemPrompt, auditPrompt)

# Step 2: submit codebase snapshot + audit result
ges_execute({
  action: "audit",
  sessionId: "<id>",
  codebaseSnapshot: "...",
  auditResult: {
    implementedACs: [0, 2],
    partialACs: [1],
    missingACs: [3],
    gapAnalysis: "..."
  }
})

Sub-Agent Spawning

Decompose a complex task into sub-tasks dynamically during execution:

ges_execute({
  action: "spawn",
  sessionId: "<id>",
  parentTaskId: "task-3",
  subTasks: [
    { title: "Write DB schema", description: "..." },
    { title: "Run migration", description: "...", dependsOn: ["spawned-<id>"] }
  ]
})

Real-Time Progress Panel

The /execute slash command displays live execution status in the Claude Code Task panel — completed/total tasks, current task name, failed count, and parallel group progress. Updated automatically at each planning step, task completion, and evaluation stage.

4. Evaluate

Execution triggers a two-stage evaluation automatically:

StageMethodOn failure
1Structural — runs lint → build → testShort-circuits; Stage 2 is skipped
2Contextual — LLM validates each AC and goal alignmentEnters the Evolution Loop

Success condition: score ≥ 0.85 AND goalAlignment ≥ 0.80

5. Evolve

When evaluation fails, the Evolution Loop engages. Three recovery flows are available:

Flow A — Structural Fix (when lint/build/test fails)

evolve_fix → submit fix tasks → re-evaluate

Flow B — Contextual Evolution (when AC score is too low)

evolve → patch Spec (ACs/constraints) → re-execute impacted tasks → re-evaluate

Spec patch scope: ACs and constraints are freely editable; ontology can be extended; goal is immutable.

Flow C — Lateral Thinking (when stagnation is detected)

Gestalt rotates through lateral thinking personas rather than terminating:

Stagnation PatternPersonaStrategy
Hard cap hitMultistabilityView from a different angle
Oscillating scoresSimplicityStrip down and converge
No progress (no drift)ReificationFill in what's missing
Diminishing returnsInvarianceReplicate what worked

When all four personas are exhausted, the session ends with Human Escalation — a structured list of actionable suggestions for manual resolution.

Termination conditions:

ConditionTrigger
successscore ≥ 0.85 AND goalAlignment ≥ 0.80
stagnation2 consecutive rounds with delta < 0.05
oscillation2 consecutive score reversals
hard_cap3 structural + 3 contextual failures
callerManual termination
human_escalationAll 4 lateral personas exhausted

6. Code Review

When evolution finishes, code review starts automatically:

review_start → agents submit perspectives → consensus → auto-fix

See Agents for the full list of built-in reviewers.

Agents

Use any agent directly, outside the pipeline:

# List all available agents
/agent

# Run a specific agent on any task
/agent architect "review the module boundaries in this codebase"
/agent security-reviewer "check this authentication code for vulnerabilities"
/agent technical-writer "write a README for this module"

Role Agents

Nine built-in role agents provide multi-perspective review:

AgentDomain
architectSystem design, scalability
frontend-developerUI, React, accessibility
backend-developerAPI, database, server
devops-engineerCI/CD, infrastructure, monitoring
qa-engineerTesting, quality, automation
designerUX/UI, design systems
product-plannerRoadmap, user stories, metrics
researcherAnalysis, data, benchmarks
technical-writerDocumentation, API docs, guides, README

Review Agents

Three built-in review agents run focused code analysis:

AgentFocus
security-reviewerInjection, XSS, auth vulnerabilities, secrets
performance-reviewerMemory leaks, N+1 queries, bundle size, async
quality-reviewerReadability, SOLID, error handling, DRY

Custom Agents

Generate a custom Role Agent from interview results:

# Step 1: get agent creation context
ges_create_agent({ action: "start", sessionId: "<id>" })
# → returns agentContext (systemPrompt, creationPrompt, schema)

# Step 2: submit the generated AGENT.md content
ges_create_agent({ action: "submit", sessionId: "<id>", agentContent: "..." })
# → creates agents/{name}/AGENT.md

CLI Mode

Run Gestalt without Claude Code. Requires ANTHROPIC_API_KEY.

# Start an interactive interview
npx @tienne/gestalt interview "my topic"

# Generate a Spec from a completed session
npx @tienne/gestalt spec <session-id>

# List all sessions
npx @tienne/gestalt status

# Generate gestalt.json config
npx @tienne/gestalt setup

# Start the MCP server manually
npx @tienne/gestalt serve

Project Memory

Every spec and execution result is automatically recorded in .gestalt/memory.json at your repo root.

{
  "specHistory": [
    { "specId": "...", "goal": "Build a user auth system", "sourceType": "text" }
  ],
  "executionHistory": [],
  "architectureDecisions": []
}

Commit it. .gestalt/memory.json is plain JSON. Teammates inherit all prior decisions on git pull.

Context injection. Prior goals and architecture decisions are automatically injected into the next spec prompt.

User profile. Personal preferences are stored in ~/.gestalt/profile.json and are never committed.

Configuration

Generate a gestalt.json with IDE autocomplete support:

npx @tienne/gestalt setup
{
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
  "llm": {
    "model": "claude-sonnet-4-20250514"
  },
  "interview": {
    "resolutionThreshold": 0.8,
    "maxRounds": 10
  },
  "execute": {
    "driftThreshold": 0.3,
    "successThreshold": 0.85,
    "goalAlignmentThreshold": 0.80
  },
  "client": "claude-code"
}

Config priority (highest → lowest): code overrides → shell env vars → .envgestalt.json → built-in defaults

Client Setting

The client field controls where Gestalt writes the active session context during execution:

ValueContext fileWhen to use
"claude-code" (default).claude/rules/gestalt-active.mdClaude Code (CLI, Desktop, Plugin)
"codex"AGENTS.md (managed section)OpenAI Codex CLI, Google Gemini CLI
"both"Both locationsShared repos used by multiple agents

"codex" is the right value for both Codex CLI and Gemini CLI — both read AGENTS.md for persistent project context.

Multi-Provider LLM Tiers

Route LLM calls by task complexity across three tiers:

TierPurposeExample models
frugalLightweight tasks — scoring, classification, short responsesllama3.2, claude-haiku
standardGeneral tasks — interviews, spec generation, executionclaude-sonnet-4-20250514
frontierHigh-complexity reasoning — architecture, code review, evolutionclaude-opus-4-20250514

Mix providers freely. This example uses Anthropic for standard/frontier and a local Ollama model for frugal tasks:

{
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
  "llm": {
    "model": "claude-sonnet-4-20250514",
    "frugal": {
      "provider": "openai",
      "baseURL": "http://localhost:11434/v1",
      "apiKey": "ollama",
      "model": "llama3.2"
    },
    "standard": {
      "provider": "anthropic",
      "model": "claude-sonnet-4-20250514"
    },
    "frontier": {
      "provider": "anthropic",
      "model": "claude-opus-4-20250514"
    }
  }
}

If no tiers are configured, all tiers fall back to the top-level llm.model with the Anthropic adapter — fully backward-compatible.

Environment Variables

VariableConfig pathDefaultDescription
ANTHROPIC_API_KEYllm.apiKey""Required only for CLI direct mode
GESTALT_MODELllm.modelclaude-sonnet-4-20250514LLM model
GESTALT_RESOLUTION_THRESHOLDinterview.resolutionThreshold0.8Interview completion threshold
GESTALT_MAX_ROUNDSinterview.maxRounds10Max interview rounds
GESTALT_DRIFT_THRESHOLDexecute.driftThreshold0.3Task drift detection threshold
GESTALT_EVOLVE_SUCCESS_THRESHOLDexecute.successThreshold0.85Evolution success score
GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLDexecute.goalAlignmentThreshold0.80Goal alignment threshold
GESTALT_DB_PATHdbPath~/.gestalt/events.dbSQLite event store path
GESTALT_SKILLS_DIRskillsDirskillsCustom skills directory
GESTALT_AGENTS_DIRagentsDiragentsCustom agents directory
GESTALT_LOG_LEVELlogLevelinfoLog level (debug/info/warn/error)
GESTALT_CLIENTclientclaude-codeMCP client type (claude-code/codex/both)
GESTALT_LLM_FRUGAL_PROVIDERllm.frugal.provideranthropicFrugal tier provider
GESTALT_LLM_FRUGAL_API_KEYllm.frugal.apiKey""Frugal tier API key
GESTALT_LLM_FRUGAL_BASE_URLllm.frugal.baseURL""Frugal tier base URL (e.g. Ollama)
GESTALT_LLM_FRUGAL_MODELllm.frugal.modelFrugal tier model
GESTALT_LLM_STANDARD_PROVIDERllm.standard.provideranthropicStandard tier provider
GESTALT_LLM_STANDARD_API_KEYllm.standard.apiKey""Standard tier API key
GESTALT_LLM_STANDARD_BASE_URLllm.standard.baseURL""Standard tier base URL
GESTALT_LLM_STANDARD_MODELllm.standard.modelStandard tier model
GESTALT_LLM_FRONTIER_PROVIDERllm.frontier.provideranthropicFrontier tier provider
GESTALT_LLM_FRONTIER_API_KEYllm.frontier.apiKey""Frontier tier API key
GESTALT_LLM_FRONTIER_BASE_URLllm.frontier.baseURL""Frontier tier base URL
GESTALT_LLM_FRONTIER_MODELllm.frontier.modelFrontier tier model

Architecture

Claude Code (you)
     │
     ▼  MCP / stdio transport
┌──────────────────────────────────┐
│        Gestalt MCP Server        │
│                                  │
│  Interview Engine                │
│  ├─ GestaltPrincipleSelector     │
│  ├─ ResolutionScorer             │
│  ├─ SessionManager               │
│  └─ ContextCompressor            │
│                                  │
│  Spec Generator                  │
│  ├─ PassthroughSpecGenerator     │
│  └─ SpecTemplateRegistry         │
│                                  │
│  Execute Engine                  │
│  ├─ DAG Validator                │
│  ├─ ParallelGroupsCalculator     │
│  ├─ DriftDetector                │
│  ├─ EvaluationEngine             │
│  ├─ AuditEngine                  │
│  └─ ExecuteSessionManager        │
│                                  │
│  Resilience Engine               │
│  ├─ StagnationDetector           │
│  ├─ LateralThinkingPersonas      │
│  └─ HumanEscalation              │
│                                  │
│  Agent System                    │
│  ├─ RoleAgentRegistry            │
│  ├─ RoleMatchEngine              │
│  └─ RoleConsensusEngine          │
│                                  │
│  EventStore (SQLite WAL)         │
└──────────────────────────────────┘

Further reading:

License

MIT © tienne

FAQs

Package last updated on 07 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts