SLOPSHOPPER

smart-compact

/smart-compact: write custom /compact instructions from the session, then compact with them

commandstatusmodeltimer
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · smart-compact
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM › /smart-compact ⎿ smart-compact: compacting with these instructions: ⎿ smart-compact: ⎿ smart-compact: OK ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts ⚠ smart-compact: smart-compact: compacting
README

<!-- generated by scripts/readme/build.mjs. do not edit by hand. -->

<img alt="Harness Firmware boots with 51 skills, 6 project-memory files, and 2 runtime boundaries ready." src="assets/readme/boot-light.svg" width="100%">

A repository starter for Claude Code and Codex. Harness Firmware gives both agents versioned instructions, durable project memory, reusable skills, and workflows for testing and independent review.

Keep project decisions and pitfalls with the code. Carry useful lessons into the next session. Review changes before carrying them into another repository.

Install the skills or start a repository · Visit harnessfirmware.com

quickstart

Use the skills-only plugin for an existing Claude Code repository. Use the full template for a new repository or Codex support.

existing repository · Claude Code plugin

Run these commands inside Claude Code:

/plugin marketplace add ryanportfolio/Harness-Firmware
/plugin install claude-starter@claude-starter

Then try /claude-starter:recall or /claude-starter:brainstorming plan the next feature. Plugin skills use the claude-starter namespace.

new repository · full template

Create a repository with the kernel, hooks, committed memory, skills, and synchronization tools:

  • GitHub: select Use this template, clone the new repository, then run Claude Code's /init-project command or ask Codex to use the init-project skill.
  • From a cloned Harness Firmware checkout on macOS or Linux: bash bootstrap/new-claude-project.sh --name my-app --dest ~/code
  • From a cloned checkout on Windows: double-click bootstrap/New-ClaudeProject.cmd.

In the created repository, run node .claude/scripts/doctor.mjs. Success means the doctor reports no failures. Then ask Claude Code or Codex to use recall before the first unfamiliar change.

Open the complete setup guide · View validation runs

what the firmware adds

NeedWorkflow built into the repository
Remember the projectrecall loads relevant committed facts, decisions, and pitfalls before unfamiliar work
Finish sustained worklong-horizon records progress and evidence across bounded rounds, with fresh audit context
Challenge a resultIndependent and cross-vendor review skills check work through available agents or authenticated CLIs
Verify a claimfable-mode separates current-state, change, and causal claims and returns a verdict; perf-loop measures optimization against a baseline
Maintain skillsaddskill handles creating, importing, updating, and installing skills with the resources each runtime needs
Improve the workflowrefine captures observed friction; sync-starter carries selected generic fixes between repositories

These are agent instructions and supporting tools. Structural checks validate the package; actual execution still needs the appropriate model, tools, credentials, and evidence.

the repository feedback loop

<img alt="Recall, work, verify, refine, and a reviewed repository change form a local loop. A separate human-approved sync can carry generic changes into future repositories." src="assets/readme/feedback-light.svg" width="100%">

The everyday loop is recall → work → verify → refine → reviewed repository change → next task. Project facts load before unfamiliar work. Verification captures evidence. refine turns observed friction into a small, reviewable change that strengthens the repository before the next task begins.

The dotted branch is separate: after human review, sync-starter can move a generic improvement into the template so future repositories begin with it. Keeping the lesson local remains the default.

two runtimes, explicit ownership

<img alt="51 Claude Code skills and 47 Codex skills share project memory. Codex has 47 native workflows." src="assets/readme/runtime-light.svg" width="100%">

51 Claude Code skills · 47 Codex skills · 47 native Codex workflows

  • Claude Code: reads CLAUDE.md, .claude/skills/, and hooks for canonical playbooks and Claude-specific startup behavior.
  • Codex: reads AGENTS.md and .agents/skills/ for standalone Codex workflows with explicit capability and safety boundaries; every Claude skill has a maintained native Codex version or is disabled for Codex. Skill ownership and personal copies explains how they are maintained.

Both runtimes read the committed project topics under .claude/reference/. Shared workflows live under .claude/skills/; standalone Codex workflows live under .agents/skills/.

51 workflows, loaded when called

8 core · 17 discipline · 26 specialist

Only names and routing descriptions sit in the repository's generated skill index. Full workflow bodies stay on demand. The diagram's byte figures are a repository source-file estimate, not total runtime context; the guide documents the measurement.

<img alt="A memory map of 51 on-demand workflows grouped into 8 core, 17 discipline, and 26 specialist skills." src="assets/readme/skills-light.svg" width="100%">

<!-- skill-list:start -->

core workflows · 8

  • init-project · Configure a starter project on setup request: detected project facts, only necessary user questions.
  • recall · Before unfamiliar project-area work; retrieve project decisions or pitfalls; save authorized durable fact; quirk just cost retry, backed-out change, or user correction → pitfalls.
  • addskill · Create, import, update, or install repo or personal skills: runtime ownership, resources, discovery checks.
  • sync-starter · Pull template improvements into a spawned repo, compare starter drift, or push a generic improvement back to the starter.
  • optimize-context · Cut per-turn context or token load: trim kernels, skills, connectors; push generic context optimization to starter.
  • refine · Explicit workflow-improvement review; user preferences → rules or skill; recurring task friction justifying a narrow skill or reference change; unattended weekly review (/refine weekly).
  • adopt-repo · Mirror external repo privately under user's account + overlay firmware: clone, strip template-only files, privacy-sweep, init-project. Use: /adopt-repo <url>, 'pull this repo into our firmware'.
  • apply-firmware · /apply-firmware, or bring current folder (plain folder, existing repo, old or partial firmware copy) up to full Harness Firmware in place. Mirror external repo → adopt-repo.

quality disciplines · 17

  • brainstorming · Brainstorm or design product, interface, workflow, architecture, or behavior change with unresolved goals or material tradeoffs. Skip routine or fully specified work.
  • deep-plan · /deep-plan: interview a loose idea in short decision rounds; stop for explicit go before anything is built.
  • writing-plans · Clear task needing a multi-step implementation plan, dependency ordering, or durable handoff. Skip routine changes doable directly.
  • impartial-review · Review, audit, or stress-test recent code changes with fresh independent agents. Needs exposed multi-agent tools or authed Codex CLI.
  • perf-loop · Measured optimization rounds with independent review: FPS, loading, latency, throughput, resources; no named target → triage every dimension first. Use: /perf-loop, broad perf requests. Skip isolated fixes.
  • security-loop · Whole-repo security audit or pen-test in independently verified runs → fix owner's picks → rerun until nothing new. Use: /security-loop, 'security-audit / pen-test this codebase'. One diff or question → security-review.
  • long-horizon · Work too big for one context window: long multi-step tasks, progress lost to compaction or failed retries, work spanning hours or sessions, /long-horizon, or 'run in verified rounds'.
  • long-horizon-workflows · Long-horizon rounds via Workflow tool: 1 script per batch, fresh baseline, candidate executors, blind pick, independent judges each round, schema verdicts, run journal. Use: /long-horizon-workflows, big task in Workflow-audited rounds. Claude Code only.
  • babysit-ci · Watch PR checks, fix failures. Use: /babysit-ci, 'watch CI', 'fix CI', 'get checks green', PR with failing or pending checks. Not a bare merge request.
  • codex-review · Cross-vendor second opinion: Codex CLI (codex exec review, gpt-6.1-sol, high) over PR, branch, commit, or uncommitted diff, then each finding verified. Use: /codex-review, 'have Codex/Sol review this'.
  • astra-review · Cross-vendor review on gpt-6-astra, medium. Same CLI lifecycle as codex-review. Use: /astra-review, 'have Astra review this'.
  • codex-fullreview · Full multi-agent Codex review: codex exec runs impartial-review as Manager with fresh sub-reviewers (gpt-6.1-sol, high), then each finding verified. Use: /codex-fullreview, 'full Codex review with sub-reviewers'.
  • astra-fullreview · Full multi-agent Codex review on gpt-6-astra, medium. Same lifecycle as codex-fullreview. Use: /astra-fullreview, 'full Astra review with sub-reviewers'.
  • merge · Merge PRs: 4 fresh-context self-reviewers + fixes, then Codex loop: /codex-fullreview, fix, /codex-review reruns (3 max) until clean, then CI + squash-merge. Only when user types /merge; then every session PR goes through it + merges.
  • claude-review · /claude-review, Claude or Fable asked to review Codex-written code, or cross-vendor review via Claude CLI.
  • dare · /dare, first principles, questioning the problem: 4 fresh stages decompose, audit, recombine, test; immutable goals + constraints kept.
  • gauntlet · Only on explicit /gauntlet: draft → dare → final draft → why → rewrite → arena → commit, stop for /merge. Skills fully; other artifacts need declared apply method + real check.

specialist tools · 26

  • fable-mode · Hard multi-step work, uncertain diagnoses, repeated failures, 'did it work/is it fixed/prove it', or tasks needing careful verification + handoff. Skip routine changes.
  • wow-loop · Evidence-gated review + repair loop, one deliverable or set of like items. Use: /wow-loop, wow factor, 'dial it to 11', target score ('get it to 8/10', 'bring everything under 6 up to 6+'), substantial visual work (3D, animation, UI, rendered docs) needing reference fidelity or repeated correction. Skip routine cosmetic edits + talk about the skill itself.
  • showpiece · Push an artifact past what people expect of its kind, any medium. Use: /showpiece, ambitious creative direction, portfolio-quality work, replacing generic AI styling. Not quiet or faithful work (forms, dashboards, exact recreations, brand matching) → ui-quality, frontend-design or project UI skill. Skip routine edits unless invoked.
  • design-prototypes · Brief → distinct image concepts (sections, features, interactions, branding) → compare → refine pick, before build. Use: /design-prototypes, prototype visual directions, compare design options. Built UI → redesign-concepts.
  • redesign-concepts · Built UI → screenshots → Codex image_gen → 10 redesign concepts → owner picks → build plan. Use: /redesign-concepts, 'show what we have to Codex, get 10 better versions', 'prototype improvements to current UI'. Brief only → design-prototypes.
  • conversion-ux · Audit, design conversion flows stage by stage (arrive to exit): each element asks easier, honest question. Paywalls, pricing, trials, sign-up, onboarding, checkout, forms, filters, booking. Use: /conversion-ux, 'why doesn't this convert', 'audit this flow'. Visual concepts → redesign-concepts; copy polish → writing.
  • ui-quality · Everyday UI quality floor (forms, dashboards, settings): build every state; audit by measuring rendered page (axe-core, focus, reflow, contrast). Use: /ui-quality, 'audit accessibility', 'is this UI production-ready', 'check this page on mobile'. Ambitious look → showpiece; conversion → conversion-ux.
  • motion-design · Animation that must read + feel right: explainers, promos, trailers, hero/UI motion, UI card loops, kinetic type, WebGL particles. Not static layout.
  • product-walkthrough · Product tour replaying real screens (product CSS + markup), guide cursor acts; embed or MP4. Use: /product-walkthrough, onboarding tours.
  • codex-image-gen · Image asset needed (icon, sprite, texture, splash, logo, marketing art, illustration) → Codex image_gen via codex exec. Use: 'generate an image', 'make an icon', 'use gpt-image / my Codex sub', placeholder → real art.
  • arena · Parallel attempts at one task, blind judging, best ideas grafted onto strongest. Use: /arena, 'try a few approaches', 'build me options', bakeoffs, competing versions, stalled long-horizon or wow-loop step.
  • lab · Explicit ask to lab or prototype a visual, UI, motion, or game-feel element with live tuning before production.
  • advocate · Only on explicit /advocate: challenge a just-made change before it lands. Never from natural-language requests.
  • why · Pressure-test a recommendation with one fresh reviewer: on /why, or before presenting own weighty rec (hard to undo, 2+ real options, real time or money at stake). Never from ordinary why questions or paraphrases.
  • enhance-prompt · User wants a rewritten, copy-ready prompt for another agent or session. Produce prompt; don't run its task.
  • handoff-audit · Draft self-contained audit prompt for a separate fresh session: exact scope, falsifiable checks. Doesn't run the audit.
  • writing · Write or edit audience-facing prose: docs, UI copy, emails, release notes, application answers; voice matching, clarity review, AI-tell cleanup. Session replies follow session conventions.
  • forge-repo-ui-skill · Synthesize a repo-specific UI or design skill from current agent skills. Not ordinary UI work or backend-only work.
  • caveman · Every session reply to user: terse Caveman prose + built-in Unslop. User-facing deliverables → Writing.
  • bro · Plain-language restatement. Use: /bro anywhere in msg, 'plain english', 'plain language', 'dumb it down', 'I don't understand', 'what does that mean'.
  • session-hub · Coordinate parallel Claude Code sessions via shared append-only HTML hub. Use: /session-hub, 'run parallel sessions on this', joining a hub, or proactively when the checkout shows edits or commits this session didn't make.
  • cache-loop · Caching or stale content.
  • seo-loop · SEO/AEO/GEO fix rounds, measured. Use: /seo-loop, 'improve SEO'.
  • coordinate · Coordinate with another named Claude Code session: read its work + recs, critique, send own rec, let it answer, once agreed have it finish; ping user only when a step needs them. Use: /coordinate <session>, 'coordinate / review / go back and forth with another session'.
  • servers · /servers, after starting a dev server, or user asks what's running, which port is which, why browsers are open, or to close old servers and browsers.
  • wrapup · /wrapup, or user asks if session is done, OK to archive, or what's left: one verdict from git, the PR, scratch files, running servers or browsers.

<!-- skill-list:end -->

checked on every change

The validation workflow checks shell and PowerShell entry points, Codex skill registration and drift from the Claude source, native skill propagation, linked skill resources, retired entrypoints, the Windows project generator, and this README's generated facts and assets. Inspect the CI runs.

.agents/skill-modes.json records which skills have a native Codex version and which are disabled for Codex. Maintenance guidance covers native updates, disabled skills, and personal copies.

Run the local health check:

node .claude/scripts/doctor.mjs

documentation

Source 1 files
hooks/register.ts 86 lines
1import type { EngineInterface, Register } from 'claude-code'
2
3// Asked of a fork of the session, which sees the whole transcript. Its answer is
4// passed to /compact as the custom instructions the summarizer follows.
5const REVIEW_PROMPT = `Review this whole conversation so far and write the custom instructions to pass to /compact. The summarizer reads them as directions for what to keep, so write imperatives to it.
6
7Keep, in priority order:
8
91. The user's goal for the session and any standing instructions or preferences they gave in it (style, scope limits, things to never do).
102. Current state: repo, branch, worktree path, PR URL, last commit SHA, deploy or preview URL, files created or changed.
113. Decisions made and the reason for each, including options the user rejected.
124. What is verified and how, and what is still unverified.
135. Open work: the next concrete step, pending questions to the user, background tasks still running.
146. Failed approaches and gotchas that would otherwise be retried.
157. Exact identifiers to keep verbatim: paths, commands, error strings, IDs, numbers.
16
17Tell the summarizer to drop resolved tangents, raw tool output, superseded plans, and anything re-readable from files or CLAUDE.md. Never invent a fact; if a state item is unknown, leave it out. Keep the block under about 300 words; cut from the bottom of the priority list first.
18
19Return exactly one fenced \`text\` block and nothing else. When the session's replies follow a named style or output style (caveman ultra, for example), make the first line \`Always use <that style>.\` so it survives the compaction; otherwise leave that line out.
20
21\`\`\`text
22Always use <reply style>.
23Goal: <one line>.
24Keep: <standing user instructions>.
25State: <branch, worktree, PR, SHA, files>.
26Decisions: <decision, why>; ...
27Verified: <what, how>. Unverified: <what>.
28Next: <next step>; open questions: <...>.
29Don't retry: <failed approach, cause>.
30Verbatim: <paths, commands, errors>.
31Drop tool output, resolved tangents, and superseded plans.
32\`\`\`
33
34Omit any line with nothing to say.`
35
36// The fork answers with one fenced `text` block; take its body.
37const fencedBody = (reply: string) => {
38  const match = reply.match(/```(?:text)?\r?\n([\s\S]*?)\r?\n```/)
39  return (match ? match[1] : reply).trim()
40}
41
42export const register: Register = on => {
43  on('session.start', async ($, e, next) => {
44    await $.command.register({
45      name: 'smart-compact',
46      description: 'Write custom /compact instructions from this session, then compact with them',
47    })
48    return next(e)
49  })
50
51  on('command.run', { command: 'smart-compact' }, async $ => {
52    $.ui.status('smart-compact: writing instructions')
53    const reply = await $.model.fork({ prompt: REVIEW_PROMPT })
54    if (!reply.isAnswered) {
55      $.ui.status(undefined)
56      return { text: `review failed (${reply.reason}); nothing compacted. Run /compact yourself.` }
57    }
58
59    const instructions = fencedBody(reply.text)
60    $.ui.status('smart-compact: compacting')
61    // The engine refuses to run a command from inside this hook, which still
62    // holds the command's turn; run it from a timer once the command finishes.
63    $.clock.after(500, () => void compactWhenIdle($, instructions, 10))
64
65    return { text: `compacting with these instructions:\n\n${instructions}` }
66  })
67}
68
69const compactWhenIdle = async ($: EngineInterface, instructions: string, triesLeft: number) => {
70  try {
71    // `$.session.compact` is refused in SDK sessions (the desktop app's Code
72    // tab); running `/compact` itself works in those and in the terminal.
73    await $.command.run({ command: 'compact', args: instructions })
74    $.ui.status(undefined)
75  } catch (err) {
76    // Retry only the refusal for a command run from inside a hook that still
77    // holds the turn; a cancelled or interrupted /compact stays cancelled.
78    if (triesLeft > 1 && /hook/i.test(String(err))) {
79      $.clock.after(1000, () => void compactWhenIdle($, instructions, triesLeft - 1))
80      return
81    }
82    $.ui.status(undefined)
83    $.ui.log(`smart-compact: compaction failed (${String(err)}). Paste the instructions above after /compact.`)
84  }
85}
86