# Memory Loop Setup

> Bootstrap the memory loop into any repo or Obsidian vault. Triggers: (1) "set up the memory loop / second brain / warm layer here" or "install this structure in another repo/vault", (2) a new project asking "make the AI remember across sessions and surfaces".

- Skill: `elliotoh-jin/memory-loop-setup` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add elliotoh-jin/memory-loop-setup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/elliotoh-jin/memory-loop-setup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Elliotoh-jin (https://skillmd.com/u/elliotoh-jin)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/elliotoh-jin/memory-loop-setup

---


# Memory loop bootstrap (memory-loop-setup)

What you are installing is not files but a **loop**: capture (6 types) → shelf
(BRIEF, caps + expiry) → recall (every surface reads it at session start) →
judgment (human gate) → new captures. The plumbing lives in `templates/`;
this skill is the procedure for planting it in a target repo.

## 0. Confirm the target

Confirm the target repo root and **2–5 domains** (e.g. investing · career · projects)
with the user — if they already came up in conversation, use those. If the target
already has `BRIEF.md` · `open-loops.md` · `sessions/`, **stop and report the current
state** (partial installs and upgrades are a human decision). If the target is not a
git repo, propose `git init` first — git is the loop's safety net.
Done when: path, domains, and file-collision status are each confirmed in one line.

## 1. Plant the files

Copy the 7 templates into the target and substitute placeholders — `{DOMAIN_N}`
(**duplicate the `## {DOMAIN_N}` section once per domain**) · `{TODAY}` (install date)
· `{TODAY+28}` (loop-ROI falsification line = install date + 28 days). If a user domain
is itself "meta/system"-like, **merge** it with the fixed `## Meta (loop health)`
section (no duplicate sections):

| Template | Target path | Role |
|---|---|---|
| `build_brief.py` | `tools/` | Warm-layer builder (§0 freshness + deadman · open decisions · catalysts · judgments · cards · habit counts) |
| `session-card-check.sh` | `tools/` (+`chmod +x`) | Stop hook — demands a card on days with real output |
| `open-loops.md` | repo root | Open decisions & catalyst registry (three closing doors) |
| `capture-log.md` | `memory/` | Judgment captures (6 types, falsification first) |
| `sessions-README.md` | `sessions/README.md` | Session-card contract (30-day shelf) |
| `hooks.json` | merge into `.claude/settings.json` | SessionStart (build) + Stop (card gate) |
| `claude-md-section.md` | insert at top of `CLAUDE.md` (create if absent) | "Read BRIEF first" session rule |

If you relocate the capture log, update the path constants at the top of
`build_brief.py` too. If the user's timezone is not the default, change
`TZ_OFFSET_H` in `build_brief.py` **and** the `TZ=` line in `session-card-check.sh`
**together** — changing only one desynchronizes the hook's and the builder's "today".
Done when: the list of created/modified files is printed.

## 2. Merge the hooks

Merge the SessionStart and Stop entries from `hooks.json` into the target's
`.claude/settings.json` **preserving existing hooks** (merge as parsed JSON in
python — no string splicing; start from `{}` if the file is absent). Done when:
`python3 -c "import json;json.load(open('.claude/settings.json'))"` passes after
the merge.

## 3. First build

Run `python3 tools/build_brief.py` — **BRIEF.md must generate even from empty
sources** (missing data shows honestly as "(none)"). Done when: BRIEF.md exists
and is within the 12 KB budget.

## 4. Brief the discipline (half of the install is habit)

Deliver the following to the user, and ignite the loop by writing the first capture
line together on the spot:
- **Only 6 capture types**: hypothesis · falsification · principle · bias · question ·
  shift. **A falsification (a broken assumption) is the most valuable.** Instructions,
  greetings, and status chatter are never captured (rule born from a measured noise incident).
- **Three closing doors**: resolve · reject (record the reason — prevents re-investigation) ·
  expire. Leaving items open-but-dead is the worst outcome — the registry rots into an archive.
- **A warm layer dies by growing**: BRIEF's caps and expiry ARE the design. The moment
  you want to raise a cap is the warning sign.
- **Human gate**: promotions into the profile/principles canon happen only after a human
  judgment. Verify an agent's report of a canon write against the actual diff.
- **The card gate will fire the day you install — that is normal.** Writing the install
  itself up as the first session card is a good ignition.
- **Optional extensions** (later, once material accumulates): a morning-nudge /
  evening-sweep cron via a resident agent, and after ~4 weeks a profile-mining pass
  (see the repo README → Optional extensions).

## Guardrails

- **Never overwrite existing files** — skip collisions and report them (§0 should have
  caught them already).
- The templates' **human-gate and no-fabrication clauses are not to be deleted or
  weakened during planting** — those clauses are the loop's quality itself (rewording
  for locale is fine).
- Record the install as a commit whose message names this skill — on an existing repo
  use a branch; on a **newborn repo (right after git init) commit straight to main**
  (avoids an unborn main).

