harness-foundry

August 13, 2026 · View on GitHub

harness-foundry

harness-foundry

CI npm Node License: MIT

Practical, composable harness engineering for production agents.

The missing runtime layer between model and reliable behaviour.

Showcase site · Showcase doc — demos, stacks, full-stack walkthroughs, and stories
Launch discussion — Show HN / first-run Q&A

Ecosystem

loop-engineering  →  harness-foundry  →  outerloop
   (patterns)         (runtime)          (governance)
RepoRole
loop-engineeringDesign reliable inner loops
harness-foundryExecute composable harness primitives
outerloopEvidence, verdict, answerability

Showcase · Core concepts · vs alternatives · architecture

The stack in 60 seconds

Model  →  Primitives  →  Runtime  →  Trace  →  Evidence
         (compose)      (session)    (jsonl)   (outerloop)

Compose harnesses from declarative primitives. Run sessions, record traces, evolve stacks from real runs.

Try it now

npx @cobusgreyling/harness-foundry init --from minimal
# From a loop-engineering pattern (LE → Foundry funnel):
npx @cobusgreyling/harness-foundry init --from loop-engineering:daily-triage
# Or scaffold both from LE:
npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok --with-foundry
foundry validate
foundry run --goal "Verify harness wiring"
foundry sessions list
foundry trace show --session <id>
foundry evolve report --session <id>

+ Governance: see the with-outerloop example for evidence → verdict → answerability.

+ Cursor / Claude Code:

foundry host integrate cursor    # or claude-code
foundry run --goal "Implement feature X" --host cursor

Or clone and run the full demo:

git clone https://github.com/cobusgreyling/harness-foundry.git
cd harness-foundry && pnpm install && pnpm build && pnpm demo

Demo (terminal)

pnpm demo — full session output
=== 1. Init harness ===
Harness "demo" initialized (minimal)
  .foundry/stack.yaml
  .foundry/stack.lock

=== 2. Validate ===
Stack is valid.

=== 5. Run session ===
Session complete
  ID: 41dfdac5-921e-4e13-9ade-1f7e35932a3c
  Host: standalone
  Status: completed
  Turns: 1

=== 7. Trace ===
session.start → stack.resolved → turn.start
primitive.activate (model/mock) → primitive.complete (model/mock)
primitive.activate (sandbox/worktree-isolated) → ...
session.end

=== 9. Evolve proposal (L2) ===
L2 proposal written — Human gate: review before applying to stack.yaml

→ Full transcript: docs/demo-terminal.txt

QUICKSTART.md · Windows

Choose your stack

PersonaGet started
Smoke / CIfoundry init --from minimal
Implementerfoundry init --from implementer
Review / triagefoundry init --from reviewer · foundry init --from triage
CI sweeperfoundry init --from ci-sweeper
MCP workerfoundry init --from mcp-worker
+ Governancefoundry init --from with-outerloop
+ IDE hostfoundry host integrate cursor

Four-layer taxonomy

LayerPackagesResponsibility
L1 InterfaceinterfaceModel providers (mock, anthropic, openai, grok)
L2 Compositioncompose, mcpTools, context, catalogue
L3 ExecutionruntimeTurn loop, sandbox, control
L4 Reliabilitytrace, evolve, emitTraces, recovery, evidence

CLI essentials

CommandPurpose
initScaffold .foundry/ with stack preset
validateCheck stack against primitive catalogue
runExecute session, write trace + lock
host integrateInstall Cursor / Claude Code integration
primitives list / showBrowse available primitives
sessions listList past sessions (from session index)
trace replayNarrative replay of a session
evolve reportL1 trace analysis
evolve proposalL2 stack diff (human review)
completionPrint bash / zsh / fish completions

CLI reference · API · composition

CI integration

jobs:
  foundry-gate:
    uses: cobusgreyling/harness-foundry/.github/workflows/foundry-gate.yml@main

docs/github-action.md

Monorepo packages

PackageResponsibility
@cobusgreyling/harness-foundry-coreSchemas, types, paths
@cobusgreyling/harness-foundry-composeStack builder, catalogue, lock
@cobusgreyling/harness-foundry-interfaceModel adapters
@cobusgreyling/harness-foundry-mcpMCP stdio JSON-RPC client
@cobusgreyling/harness-foundry-runtimeSession runner
@cobusgreyling/harness-foundry-traceTrace recorder
@cobusgreyling/harness-foundry-evolveL1/L2 evolution
@cobusgreyling/harness-foundry-emitouterloop evidence
@cobusgreyling/harness-foundry-hostCursor / Claude Code adapters
@cobusgreyling/harness-foundryfoundry CLI

Status

v0.5.1 — Catalogue depth (≥ 25 primitives), enforced policy primitives, host-bridge traces, session index.

Platform plan (six pillars → v1): catalogue → registry → evolve → fleet → observe → bench.

CHANGELOG.md · ROADMAP.md · Platform roadmap

Development

git clone https://github.com/cobusgreyling/harness-foundry.git
cd harness-foundry && pnpm install && pnpm build && pnpm test
pnpm demo
pnpm demo:outerloop   # full stack with outerloop

Dev Container: open in VS Code / GitHub Codespaces — .devcontainer/ runs install + build on create.

Contributor start here · CONTRIBUTING.md · Good first issues
Code of Conduct · Security policy

Contributors

NameGitHubRole
Cobus Greyling@cobusgreylingCreator & maintainer

CONTRIBUTORS.md · contributors graph

Contributing philosophy

  • Primitives are versioned, declarative, and swappable.
  • Traces drive evolution — report before you tune.
  • Human gates before stack auto-apply.
  • Don't want to touch TypeScript? Propose a primitive.

Built on loop-engineering, companion to outerloop, and the broader agentic engineering community.