⚡ Zero Runtime Dependencies • Multi-Provider • MCP Ready
Smoke Monkey Harness
An embeddable, framework-agnostic TypeScript runtime for building autonomous looping AI agents, code editors, and developer tools with deterministic phase execution and human-in-the-loop safety.
pnpm add @smoke-monkey/harness
6 Phases
Deterministic State Machine
18 Providers
Direct Cloud & Local LLMs
24 Tools
Filesystem, Shell, Git & MCP
0 Deps
Pure Vanilla TypeScript Core
01. Architecture & The 3 Pillars
Unlike monolithic frameworks that bundle bloated abstractions and opaque prompts, Smoke Monkey separates the autonomous execution loop, the human-in-the-loop permission model, and the frontend presentation layer into three modular packages:
The Three Pillars of Smoke Monkey: UI Presentation, Autonomous Harness, and MCP Extensibility
Zero-dependency TypeScript agent loop, 6-phase state machine, runaway step guards, context compaction, and modular sub-context memory.
3. Extensibility
@smoke-monkey/mcp
22 built-in MCP development tools, stdio & HTTP SSE connectors, scaffolding engine, and IDE plugin bundles (Claude Code, Cursor, Copilot).
02. Quickstart & First Agent
Create an autonomous coding agent with full file access, self-healing reflection, and terminal execution in under 20 lines of TypeScript:
agent.ts
import { createAgent } from '@smoke-monkey/harness';
// Initialize the agent with your choice of provider
const agent = createAgent({
provider: 'nvidia', // 'openai' | 'anthropic' | 'groq' | 'deepseek' | 'ollama' | ...
model: 'nvidia/nemotron-3-super-120b-a12b',
workspacePath: process.cwd(),
autoApprove: true, // auto-approve read and mutation tools for non-interactive runs
});
// Stream real-time tokens and tool events
agent.on('text.delta', (e) => process.stdout.write(e.data.delta));
agent.on('tool.started', (e) => console.log('\n⚙️ Running tool:', e.data.toolName));
agent.on('phase.changed', (e) => console.log(`\n🔄 Phase: ${e.data.from} ➔ ${e.data.to}`));
// Execute task
const result = await agent.run('Inspect this repository, locate package.json, and explain its scripts');
console.log('\n✅ Task finished with status:', result.status);
03. The 6-Phase Agent Loop & Self-Healing
Unconstrained AI agents often suffer from infinite loops, goal drift, and hallucinated successes. Smoke Monkey bounds agent execution inside a deterministic state machine:
Deterministic 6-Phase State Machine: explore ➔ plan ➔ edit ➔ verify ➔ recover ➔ complete
Instead of overloading the system prompt with dozens of long workflow instructions, Smoke Monkey implements a Two-Tier JIT Injection Pattern providing 94% token savings:
Tier 1 (Index Catalog): The model sees only skill names and a 1-line summary (~150 tokens total).
Tier 2 (On-Demand Activation): When a skill is needed, the model calls use_skill and only the relevant instruction file is injected into the active turn.
08. Sub-Contexts & Modular Memory
Break down monolithic system prompts into modular blocks (e.g. code-review, security-audit, database-expert) that can be activated dynamically at runtime using context_manage without resetting the session memory.
09. Lifecycle Hooks & Error Hierarchy
Intercept model turns and tool executions with fail-closed security policies, PII redaction, and deterministic error handling: