# Building your own open harness

## 00 · The Open Harness Thesis

In [The Harness](https://thetokendepartment.com/essays/the-harness/), we broke an agent into a hot-swappable model plus the software around it that manages instructions, tools and context. That separation only pays off if **you own the harness**.

If you do not own your harness, you do not own your memory. When the harness and long-term memory sit behind a model provider's API, you have zero visibility into how context is stored or retrieved and zero portability when a better model arrives. Even with a closed AI coding app running locally, proprietary session logs lock your history inside one vendor's format so another tool cannot read them.

Building your own **open harness** pulls four layers onto your own filesystem:

- **Your prompt (`AGENTS.md`).** One short rulebook loaded at the start of every chat.
- **Your tools (`skills/` and a personal command-line helper).** Repeatable playbooks and deterministic scripts stored in plain files.
- **Your long-term memory.** Structured Markdown vaults and repository docs you can read in any text editor.
- **Your short-term continuity.** Session notes and handoff briefs saved in a shared `Agents` vault before long chats lose detail.

That leaves the model provider API as a clean, stateless utility you rent on demand.

| Dimension | Closed harness | Open harness |
| --- | --- | --- |
| Who controls the rules & code | The vendor | You (versioned in Git) |
| Where memory lives | Behind an API or in private app silos | Plain local Markdown vaults you own |
| Model lock-in | Tied to one vendor's models | Bring any model or AI coding app |
| Run on your own infrastructure | Usually no | Yes, across desktop, laptop and cloud server (VPS) |
| When it breaks at 2am | File a ticket and wait | Read the file, patch it, commit it |
| What you pay for | The runtime and everything bolted on | Only the models you call |

Below are six core concepts and a starter setup kit for building that open harness across every device and AI tool, starting with why Git and GitHub sit at the root and ending with automated checks, comment hygiene and reusable starter skills.

## 01 · Git & Home Repo (Why GitHub beats local folders)

**Git** is a version-control tool that records every edit you make to a folder of files as a saved checkpoint you can inspect or undo. **GitHub** is the default online home for storing that Git repository so your laptop, desktop, cloud server and teammates always pull the same clean version (see our interactive [Using GitHub guide](https://thetokendepartment.com/guides/using-github/)).

[Matt Pocock](https://www.aihero.dev/the-home-repo-pattern) names the central folder for your AI setup the **Home Repo**. It is one ordinary Git repository (for example `~/Repos/home`) holding your shared `AGENTS.md` rulebook, portable app templates, documentation and reusable skills.

Plain local settings folders break down the moment you work across multiple devices or collaborate with colleagues. Local folders have no history, no diffs, no pull requests and no safe way to undo a bad rule edit. Putting your open harness on GitHub turns personal AI configuration into reliable engineering. Across multiple machines, a safe fast-forward pull (`--ff-only`) brings every computer into lockstep without overwriting unsaved local edits. In a team, the same Git workflow lets colleagues review shared skills through pull requests and automated checks instead of pasting prompts in chat.

Placing your skills inside `~/Repos/home` also gives your home directory (`~/`) three unmistakable top-level folders, each with one sync rule:

- `(1)` `~/Repos/` holds every Git checkout, versioned on GitHub and verified by automated checks.
- `(2)` `~/Obsidian/` holds living Markdown vaults synced continuously across devices via Obsidian Sync and indexed locally with QMD.
- `(3)` `~/Scratch/YYYY-MM-DD/` holds dated temporary drafts and exports that never sync or commit. Removing old duplicate shortcut folders ensures broken paths fail immediately on their first run.

## 02 · AGENTS.md (Shared input, kept short)

Most AI setups degrade because people treat their global instruction file like an attic, pasting every preference and workflow into one giant prompt. Models lose recall long before their context window fills up, so every unnecessary paragraph loaded at the start of a chat competes with the rules that matter.

Keep your root `~/Repos/home/AGENTS.md` short (under 180 lines; the working example in this guide runs 157 lines, roughly 1,260 words). Its real job is **progressive disclosure**. Loaded at turn one across every AI app, it holds standing rules and acts as a live map pointing to deeper files loaded only when a task needs them:

- `(1)` **Standing guardrails.** Writing standards, approval gates before public or external writes, secrets discipline and a handoff limit around 30% context usage (or 300k tokens) so long chats save a summary before older details fade.
- `(2)` **One personal command entry point.** A single short CLI helper (called `b` in the examples here, though you can pick any name) fronting everyday scripts (`sync`, `vault`, `mail`, `cal`, `x`, `qmd`, `sessions`) so agents never guess scattered file paths.
- `(3)` **The live map of the machine.** Clear pointers to your repositories in `~/Repos/`, your Markdown vaults in `~/Obsidian/` and deeper reference docs (`docs/data-access.md`, `docs/glossary.md`, `docs/adr/`). Narrower rules live inside each project folder's own `AGENTS.md`, loaded only when you enter that project.

## 03 · SDKs & Symlinks (Wiring every AI app to one source)

Every AI coding app looks for global rules and skills inside its own hidden settings folder (called a **dot-folder**) under your home directory (`~/`). Claude Code reads `~/.claude/CLAUDE.md` and `~/.claude/skills/`. Codex reads `~/.codex/AGENTS.md` and scans `~/.agents/skills/` while keeping `~/.codex/skills/.system/` for built-in tools. Gemini CLI and Antigravity read `~/.gemini/GEMINI.md` and `~/.gemini/AGENTS.md`. Cursor scans `~/.cursor/skills/`. Muse keeps settings in `~/.config/muse/settings.json` and shares `~/.agents/skills/`. Grok CLI reads `~/.grok/`.

A **symlink** is a live file shortcut. Editing the real file in your Home Repo updates every linked app on its next turn. Staying open-harness across all of these tools relies on two symlink layers and lightweight template merging:

- `(1)` **One `AGENTS.md`, linked everywhere.** A single real file at `~/Repos/home/AGENTS.md` symlinks into every AI app's dot-folder and repo root (`CLAUDE.md`, `GEMINI.md`). Edit once, commit once and every app receives the update automatically.
- `(2)` **Grouped skills in Git, flat per-skill links on disk.** Organise skill folders by domain inside Git while a sync script projects one shortcut per skill into each app's skills directory. Vendor built-in folders stay untouched, and each device can mount only the skills it needs (for example desktop tools on your Mac and server-scoped skills on a cloud server).
- `(3)` **Safe template merging and one CLI.** Small portable templates merge shared preferences into each app's real `settings.json` or `config.toml` while preserving machine-local logins, permissions and local hooks. One compact Python script at `~/.local/bin/b` (or any command name you choose) puts personal scripts behind a consistent `--help`, `--dry-run` and `--json` contract.

## 04 · The Agents Vault (Shared memory across tools)

`AGENTS.md` solves **shared input**. Almost nobody talks about the matching half, **shared memory**.

Every AI coding app traps chat history inside its own private local logs and databases. Claude Code stores JSONL transcripts under `~/.claude/projects/`. Codex writes inside `~/.codex/sessions/`. Cursor keeps history in local SQLite. Switch from Codex on your laptop to Claude Code on your desktop, or hand a half-finished task to a newer model tomorrow, and the new agent starts with total amnesia.

The fix is a dedicated operational **Agents Vault** (`~/Obsidian/Agents/`), a plain folder of Markdown notes synced across devices via Obsidian Sync and indexed locally by QMD. `AGENTS.md` tells every AI app to read from and write to this exact same vault:

- `(1)` **Structured session notes (`Sessions/YYYY-MM-DD <slug>.md`).** Every non-trivial run opens a plain Markdown note with a short header block at the top (`agent:`, `host:`, `status: done | blocked | failed`, `started:`, `ended:`) and closes with a crisp `## Outcome`. Any model can search past work in seconds using `b qmd query "<topic>" -c sessions` or list recent runs with `b sessions`.
- `(2)` **Pre-compaction handoff briefs (`Sessions/Handoffs/`).** Around 30% context usage (before a tool summarises away older chat turns), the working agent finishes its current step and writes goal, decisions, touched files and the exact next step into a dated handoff note. A fresh session on any model provider can pick up cold without losing detail.
- `(3)` **Operational isolation and one safety rule.** Skill run logs and audit reports live in `Ops/` and `Audits/`, kept tidy by an automatic 14-day archive sweep. Never place a symlink inside a synced Obsidian vault pointing outward. Obsidian Sync treats symlink targets as real files, so a cleanup on another device can sync deletions straight back into your Git repository.

## 05 · Context, glossaries & documentation

Good rules still fail when notes are tangled or key definitions live only in your head. It helps to separate **context** from **knowledge**. Context is whatever an AI sees during one run. Knowledge is the curated, reusable library you maintain so every future agent gets the job right without asking the same questions twice.

First, separate durable human notes from automated agent logs. Splitting `~/Obsidian/` into clear tiers (`Core` for personal essays and notes, dedicated project vaults and `Agents` for operational logs) gives each tier its own `AGENTS.md`, schema and QMD search index. Under the **Boundary Rule**, AI tools write freely inside `Agents`, ask for explicit approval before changing personal or project vaults and keep `Core` human-written at its root.

Second, structure reusable repository knowledge across three clear layers, paired with a weekly update loop:

- `(1)` **How to do the work (Skills).** Repeatable playbooks, helper scripts and checklists stored in `skills/` and fronted by your personal CLI. Turn recurring habits into short `SKILL.md` files loaded only when needed.
- `(2)` **How your world works (Domain knowledge).** Slow-changing definitions, standards and engineering decisions. Keep a concise `docs/glossary.md` where each preferred term carries an explicit **`Avoid`** column of banned synonyms (stopping models from inventing drifting labels across code and prose), a `DESIGN.md` naming visual references and clichés to exclude and numbered Architecture Decision Records (ADRs) under `docs/adr/`.
- `(3)` **Where live truth lives (Data access guidance).** Never copy fast-changing data into static Markdown notes. Maintain one on-demand `docs/data-access.md` table declaring which live source is authoritative, which device can reach it and what it costs (for example zero-cost local archive search on a desktop versus metered web search on a cloud server).

Do not maintain all three layers by hand, and do not let working agents rewrite shared rules mid-task or contradictions pile up fast. Have working agents **flag missing or conflicting rules** into a lightweight inbox mid-task, then run a scheduled **curator pass** over recent session notes and flagged gaps to open clean pull requests for your review.

## 06 · CI discipline, hygiene ratchets & deleting comments

Stale, bloated files slow down both Git and model recall. AI coding tools also work in rapid loops. When automated checks (Continuous Integration, or **CI**) take fifteen minutes or break on fragile tests, agents stall, burn tokens or try to silence red checks with retries and skipped tests.

Holding the line takes two mechanisms working together, **fast tiered checks** and **ratchets** (committed limits that only move downward):

- `(1)` **Fast local Git hooks and sub-minute pull-request CI.** Local `.githooks/pre-commit` checks run in under a second on staged files (blocking large binaries, noisy code comments and syntax errors). `.githooks/pre-push` runs fast local tests for changed files in under 9 seconds. Pull-request CI on GitHub stays under one minute for most pull requests and under two minutes at the slow end, while every push to `main` runs the full test suite unconditionally. Never add retries, wider timeouts or skipped tests to paper over a failure. Test real contracts, security and publish gates rather than fragile whitespace snapshots.
- `(2)` **Binary and line-budget ratchets.** In a real-world cleanup case study, converting raw PDFs and EPUBs to plain Markdown and purging 4,986 raw files shrank a 1.6 GB repo to 389 MB (down 76%). A committed JSON baseline blocks any new file over 1 MiB, banned binary formats (`.pdf`, `.epub`, `.djvu`, `.pptx`), stray fonts and `_archive` folders. Root `AGENTS.md` stays under 180 lines and every `SKILL.md` stays under 100 lines. Delete an explanation and check whether output changes; if nothing changes, it is pure token tax.
- `(3)` **Deleting superfluous comments (`/delete-comment` Hygiene Skill).** Coding agents love narrating obvious lines and leaving excuse comments that justify hacky workarounds, which later agents copy across the repo. Sort every inline comment into four buckets: **Tautology** (delete), **Stale** (delete), **Excuse** (delete and open a GitHub issue for the underlying bug) and **Decision Record** (move into `docs/adr/NNNN-slug.md` first, then delete inline). Keep only executable script headers, licences, lint or type directives and tool markers. In one cleanup across 424 files, this burned clutter comments from 4,835 lines down to 8 (down 99.8%), locked permanently by a shrinking JSON ratchet. This workflow is coming soon as a packaged skill at `/skills/hygiene/`; in the meantime, paste the full prompt from Section 06 directly into any repository.

## 07 · Setup kit & starter skills

You do not need to create these folders or shortcuts by hand. Use the interactive prompt customiser (adapted from [Matt Pocock](https://www.aihero.dev/the-home-repo-pattern#set-one-up)) to audit your machine read-only and build your own open harness, or install reusable starter skills from `/skills/` (`vault-setup`, `recall`, `retrospective`, `skill-manager` and the upcoming Hygiene Skill at `/skills/hygiene/`).

[Canonical HTML](https://thetokendepartment.com/guides/open-harness/)
