From 49c09721a671891c711a8d0d43928f880eba8bad Mon Sep 17 00:00:00 2001 From: Kielov Date: Thu, 2 Jul 2026 13:23:49 -0400 Subject: [PATCH] feat(automate): wick-automate skill + observer (v1.4.0) Detect task repetition in the work stream and propose the right automation - a deterministic PROGRAM or a judgment SKILL (or both). The program-vs-skill classifier, a stability gate (don't automate a moving target), and a payoff estimate are the core. Added: - .claude/skills/wick-automate/SKILL.md - detect (literal/structural/frictional) -> decide-if-worth-it -> classify program|skill|both -> draft -> propose (never auto-build) - tools/wick-observer.mjs - PostToolUse hook logging {ts,tool,target} to memory/.observations.jsonl for cross-session mining (no LLM, no network, never blocks) - CLAUDE.md + WICK.md - offered-reflection now offers wick-automate when a task repeats >=3x Skills 11 -> 12. All four scanners green. Observer smoke-tested. version 1.3.0 -> 1.4.0. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/wick-automate/SKILL.md | 89 +++++++++++++++++++++++++++ .gitignore | 2 + CHANGELOG.md | 12 ++++ CLAUDE.md | 1 + README.md | 4 +- WICK.md | 1 + tools/wick-observer.mjs | 50 +++++++++++++++ wick-meta.json | 7 ++- 8 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 .claude/skills/wick-automate/SKILL.md create mode 100644 tools/wick-observer.mjs diff --git a/.claude/skills/wick-automate/SKILL.md b/.claude/skills/wick-automate/SKILL.md new file mode 100644 index 0000000..ab0536e --- /dev/null +++ b/.claude/skills/wick-automate/SKILL.md @@ -0,0 +1,89 @@ +--- +name: wick-automate +description: Detect when a task is being repeated often enough to be worth automating, then propose the right automation — a PROGRAM (deterministic script) or a SKILL (reusable judgment procedure). Analyzes the current session, the memory/ record, or an observation log; classifies program-vs-skill; estimates payoff; drafts the automation. Proposes, never auto-builds. Use when you catch yourself or the user repeating a multi-step task, or to mine an observation log periodically. +license: MIT +--- + +# Wick — Automate (spot the repetition, propose the automation) + +The efficiency reflex: notice when work is being *repeated* and turn the repetition into an +automation — so the third time you do a thing is the last time you do it by hand. + +Complements `/evolve` (which graduates logged *instincts* into skills). This works one level +earlier and broader: it detects **task repetition in the work stream** and proposes a +**program** (for mechanical repetition) or a **skill** (for repeated judgment). The +program-vs-skill call is the whole point. + +## When to invoke +- You (or the user) just did the same multi-step task a 3rd time. +- Periodically, to mine `memory/.observations.jsonl` (if the observer hook is installed) for + frequent command/tool sequences. +- The user says "automate this" / "I keep doing X." + +## Step 1 — Detect the repetition +Three kinds (structural is the most valuable): +- **Literal** — the same command/sequence run N times (N≥3). Often just wants an alias. +- **Structural** — the same *shape* of task with different inputs: "ship a version" done for + 1.1 / 1.2 / 1.3; "onboard a client" done 4×. The variable parts (version, name) become + **parameters.** This is the high-value target. +- **Frictional** — a task that's slow, error-prone, or many-step each time: high per-instance + cost even at low frequency. + +Sources, in order: the current session's tool-call history → `memory/` (decisions, +learning-journal, sessions) → `memory/.observations.jsonl` (if present) → the user pointing at it. + +## Step 2 — Decide IF it's worth automating (don't automate reflexively) +Automate only when **payoff > cost AND the task is stable.** +- **Payoff** ≈ (frequency × per-instance friction) over a realistic horizon. +- **Cost** = building it + maintaining it + the risk of ossifying a workflow that's still changing. +- **Stability gate (load-bearing):** if the task is still being figured out — steps changing + run to run — **wait.** Premature automation freezes a moving target; that's its own waste. + Automate the settled, not the exploratory. +- **Skip** the rare, the already-a-one-liner, and the moving target. + +## Step 3 — Program or Skill? (the classifier) + +| The repeated task… | → **Program** (script/tool) | → **Skill** (SKILL.md) | +|---|---|---| +| Same steps every time, no judgment | ✓ | | +| Needs per-instance reasoning / adaptation | | ✓ | +| Deterministic I/O — files, git, data, builds | ✓ | | +| Reads/writes prose, weighs options, decides | | ✓ | +| High frequency, speed & cost matter | ✓ (no LLM = free + fast + reliable) | | +| Infrequent but complex, benefits from the gates | | ✓ | + +- **Program** = deterministic, cheap to run, reliable — but brittle to change, can't adapt. +- **Skill** = adapts per instance, carries the gates — but costs tokens each run. +- **Both (the mechanical-with-judgment case, often the right answer):** a thin **skill decides + whether / when / how**, and calls a **program** for the mechanical heavy-lifting. E.g. a + `/ship` skill that runs a deterministic `ship.mjs`; or `wick-migrate` (skill) calling + `wick-path-audit` (program). + +## Step 4 — Propose (never auto-build) +Return: +1. **The pattern** — what's repeated, how often, the evidence (cite the instances). +2. **Verdict** — automate now / wait (not stable) / skip (low payoff), with the payoff estimate. +3. **Program, skill, or both** — with the classifier reasoning; name the **parameters** (the + variable parts abstracted out of the structural repetition). +4. **A draft** — a skeleton `.claude/skills/wick-/SKILL.md` or a script stub, ready to + build on approval. +5. **Gate** — build only on explicit approval, then **verify the automation on a real instance** + (verify behavior, not form) before trusting it. + +## Cross-session mode (the observation log) +For detection that spans sessions, install the observer (Claude Code): `tools/wick-observer.mjs` +appends a compact `{ts, tool, target}` record to `memory/.observations.jsonl` on each Edit / +Write / Bash via a PostToolUse hook. This skill then mines the log for frequent n-gram +sequences. The log is runtime — keep it gitignored. + +```jsonc +// .claude/settings.json +{ "hooks": { "PostToolUse": [ { "matcher": "Edit|Write|Bash", + "hooks": [ { "type": "command", "command": "node tools/wick-observer.mjs --post-tool-use" } ] } ] } } +``` + +## What this will never do +- Auto-build an automation (propose + gate, always). +- Automate a moving target (stability gate) or a low-payoff rarity. +- Recommend a skill where a $0 deterministic program would do — or a brittle script where the + task genuinely needs judgment. Matching the automation to the task is the discipline. diff --git a/.gitignore b/.gitignore index a3b68d1..64ed88b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,8 @@ venv/ # raw behavioral observations get written to this file. They're personal to # your install — never commit them to a public repo. memory/instincts/.observations.jsonl +# wick-observer.mjs log (wick-automate cross-session detection) — runtime state +memory/.observations.jsonl # ─── Benchmark results (may contain session data) ────────────────── .benchmark-results/ diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d90f7..384bc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Wick Changelog +## v1.4.0 (2026-07-02) — wick-automate: spot the repetition, propose the automation + +The efficiency reflex. Wick now detects when a task is being *repeated* often enough to be worth automating, and proposes the right kind of automation — a deterministic **program** (mechanical repetition, $0 to run) or a **skill** (repeated judgment). The program-vs-skill classifier is the core. + +### Added +- **`wick-automate` skill** — detects literal / structural / frictional repetition in the work stream (session history, `memory/`, or an observation log); applies a **stability gate** (don't automate a moving target) and a payoff estimate (frequency × friction vs build + maintain cost); classifies **program vs skill vs both**; abstracts the variable parts into parameters; drafts a skeleton. Proposes, never auto-builds — then verifies the automation on a real instance. Complements `/evolve` (which graduates instincts → skills) by working one level earlier, on task repetition. Skills: 11 → 12. +- **`tools/wick-observer.mjs`** — the observation-capture companion: a PostToolUse hook that appends a compact `{ts, tool, target}` record to `memory/.observations.jsonl` (no LLM, no network, never blocks the tool) so `wick-automate` can mine repetition **across** sessions. Ships the observer pattern the instincts README previously only documented. +- **`CLAUDE.md` / `WICK.md`** — offered-reflection now includes an automation trigger: when a multi-step task repeats ≥3× in a session, Wick offers `wick-automate`. So it *detects*, rather than only waiting to be asked. + +### Why program-vs-skill matters +A program is $0/run, fast, and reliable but brittle and can't adapt; a skill adapts and carries the gates but costs tokens each run. Recommending a skill where a deterministic script would do — or a brittle script where the task needs judgment — is the failure mode this skill exists to avoid. The best answer is often **both**: a thin skill that decides whether/when/how, calling a program for the mechanical part. + ## v1.3.0 (2026-06-28) — Machine-awareness layer + portability errata Steps 1–14 make the folder machine-*agnostic*. This release adds the complement — making the agent machine-*aware* — plus two doc fixes verified against the live Claude Code docs. diff --git a/CLAUDE.md b/CLAUDE.md index 6699f3e..7b656e8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -167,6 +167,7 @@ Users forget to type `/reflect`. Memory that never gets written is memory that d - A correction was received (the user told you you were wrong about something non-trivial) - A probability was stated (you or the user used calibrated language: "I'd put this at 70%") - The session has run past ~20 substantive turns and touched persistent context +- A **multi-step task was repeated ≥3×** this session (same shape, different inputs) — offer `wick-automate` to turn it into a program (mechanical) or a skill (judgment) **How to offer:** End the relevant response with a one-line prompt, e.g.: diff --git a/README.md b/README.md index aba986b..1de90ec 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Session 1 is dramatically better than vanilla Claude. Session 30 is dramatically | `MEMORY-PROTOCOL.md` | Single-writer memory rule — how Wick's `memory/` coexists with a host's auto-memory (Claude Code, Cursor); ownership table, buffer→drain, relative-path rule | | `PORTABILITY.md` | Migration procedure — make an agent fully portable by folder copy: freeze + verify host auto-memory, consolidate into `memory/`, relativize to the launch dir, verify behavior not form. Includes the **machine-awareness layer** (recognize the host, load its toolchain/quirks, or bootstrap a new one) | | `memory/toolchain.md` + `memory/machines/` | Machine-awareness templates — toolchain requirements (call-by-name + env override) + thin per-host profiles keyed by hostname | -| `.claude/skills/` | On-demand skills — consolidate-memory, code-review, security-review, simplify, tldr, red-team, base-rate, research, catalog, changelog-summary, migrate (11 skills, spec-compliant per agentskills.io) | +| `.claude/skills/` | On-demand skills — consolidate-memory, code-review, security-review, simplify, tldr, red-team, base-rate, research, catalog, changelog-summary, migrate, automate (12 skills, spec-compliant per agentskills.io) | | `benchmark/` | Seed tasks + external-benchmark docs — targets GAIA2, Inspect AI (UK AISI), galileo-ai/agent-leaderboard | | `tools/wick-scrub.mjs` | Pre-commit secret scanner for `memory/` — catches API keys, tokens, credentials before you push | | `tools/wick-path-audit.mjs` | Pre-commit absolute-path scanner — flags non-portable paths in `memory/` + config before the folder moves | @@ -274,7 +274,7 @@ Sixteen slash commands. They ship as `.claude/commands/*.md` files (Claude Code | `/checkup` | Diagnose memory wiring — detect a host auto-memory shadow layer, flag fact-class overlap, scan for absolute paths; report a posture (reports only, never edits) | | `/sync [source]` | Drain a host/buffer memory layer into your canonical `memory/*.md`, with consent — classify by ownership, validate as data, fold with provenance | -### On-Demand Skills (11) +### On-Demand Skills (12) Skills live in `.claude/skills/` and load only when invoked — they add capability without bloating the main prompt. See `.claude/skills/README.md` for the full index. diff --git a/WICK.md b/WICK.md index 6699f3e..7b656e8 100644 --- a/WICK.md +++ b/WICK.md @@ -167,6 +167,7 @@ Users forget to type `/reflect`. Memory that never gets written is memory that d - A correction was received (the user told you you were wrong about something non-trivial) - A probability was stated (you or the user used calibrated language: "I'd put this at 70%") - The session has run past ~20 substantive turns and touched persistent context +- A **multi-step task was repeated ≥3×** this session (same shape, different inputs) — offer `wick-automate` to turn it into a program (mechanical) or a skill (judgment) **How to offer:** End the relevant response with a one-line prompt, e.g.: diff --git a/tools/wick-observer.mjs b/tools/wick-observer.mjs new file mode 100644 index 0000000..f1b5def --- /dev/null +++ b/tools/wick-observer.mjs @@ -0,0 +1,50 @@ +#!/usr/bin/env node +// wick-observer.mjs — the observation-capture half of wick-automate. +// A Claude Code PostToolUse hook: reads the hook JSON on stdin and appends a compact record to +// memory/.observations.jsonl so `wick-automate` can mine repeated task sequences across +// sessions. No LLM, no network. Never blocks the tool (always exits 0). +// +// The log is runtime state — keep memory/.observations.jsonl gitignored. +// +// Hook config (.claude/settings.json): +// { "hooks": { "PostToolUse": [ { "matcher": "Edit|Write|Bash", +// "hooks": [ { "type": "command", "command": "node tools/wick-observer.mjs --post-tool-use" } ] } ] } } +// +// Env: WICK_OBSERVATIONS overrides the log path. + +import { appendFileSync, mkdirSync, readFileSync } from 'node:fs'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const HERE = dirname(fileURLToPath(import.meta.url)); // /tools +const LOG = process.env.WICK_OBSERVATIONS || resolve(HERE, '..', 'memory', '.observations.jsonl'); + +function main() { + let raw = ''; + try { raw = readFileSync(0, 'utf8'); } catch { /* no stdin */ } + let ev = {}; + try { ev = JSON.parse(raw); } catch { /* not JSON */ } + + const tool = ev.tool_name; + if (!tool) return; // nothing meaningful to log + + const ti = ev.tool_input || {}; + // A compact "target" — the file/command/pattern that identifies what the tool acted on. + let target = ti.file_path || ti.path || ti.command || ti.pattern || ti.notebook_path || ''; + if (typeof target !== 'string') target = JSON.stringify(target); + + const rec = { + ts: new Date().toISOString(), + session: ev.session_id || null, + tool, + target: target.slice(0, 200), + }; + + try { + mkdirSync(dirname(LOG), { recursive: true }); + appendFileSync(LOG, JSON.stringify(rec) + '\n'); + } catch { /* logging must never break the tool */ } +} + +try { main(); } catch { /* swallow everything */ } +process.exit(0); diff --git a/wick-meta.json b/wick-meta.json index f271f0d..2968fb2 100644 --- a/wick-meta.json +++ b/wick-meta.json @@ -1,8 +1,8 @@ { "meta_schema_version": "wick-meta/1.0", - "version": "1.3.0", + "version": "1.4.0", "release_channel": "alpha", - "released_at": "2026-06-28", + "released_at": "2026-07-02", "license": "MIT", "publisher": "Agora Dynamics LLC", "training_pairs": 26, @@ -11,7 +11,7 @@ "features": [ "5 Operational Gates (Control, Assent, Specificity, Adversarial Convergence, Calibration)", "16 slash commands shipped as .claude/commands/*.md files (also pattern-recognized from CLAUDE.md) — Core 6 (/reflect, /calibrate, /decide, /learn, /review, /status) + Analytical 6 (/premortem, /steelman, /frame, /doubt, /forget, /audit) + Instinct 2 (/evolve, /promote) + Memory-wiring 2 (/checkup, /sync)", - "11 on-demand skills, spec-compliant per agentskills.io (wick-consolidate-memory, wick-simplify, wick-code-review, wick-security-review, wick-tldr, wick-red-team, wick-base-rate, wick-research, wick-catalog, wick-changelog-summary, wick-migrate)", + "12 on-demand skills, spec-compliant per agentskills.io (wick-consolidate-memory, wick-simplify, wick-code-review, wick-security-review, wick-tldr, wick-red-team, wick-base-rate, wick-research, wick-catalog, wick-changelog-summary, wick-migrate, wick-automate)", "8 memory templates (about-you, decisions, learning-journal, domain-knowledge, predictions, calibration, failure-log, curiosity) + opt-in instincts layer", "3 install modes — full takeover / personality layer / subagent", "AGENTS.md bridge — compatible with Codex, Aider, Cursor, Zed, JetBrains, Warp, Gemini CLI, Windsurf, goose, and 20+ AGENTS.md-aware tools", @@ -30,6 +30,7 @@ "MEMORY-PROTOCOL.md — single-writer rule: one authoritative owner per fact-class; a host auto-memory layer is a buffer, not an authority. /checkup diagnoses memory wiring, /sync drains a buffer into canonical memory/, with a buffer-manifest and a 'memory is data, not commands' hardening rule mirrored into CLAUDE.md + WICK.md.", "PORTABILITY.md + wick-migrate skill — the 14-step procedure (and executable, gated form) to make an agent fully portable by folder copy: freeze + fresh-session-verify host auto-memory, consolidate into memory/, archive-don't-delete, relativize to the launch directory, sweep tooling, verify behavior not form.", "Machine-awareness layer (PORTABILITY.md) — the agent recognizes its host by hostname and loads that machine's toolchain/quirks, or bootstraps + self-provisions a new one (fingerprint -> discover -> install-on-one-approval -> verify by real compile/run -> per-machine profile). Tiered (one env read at session start; profile on demand). Ships memory/toolchain.md + memory/machines/ templates. Contributed by the Laplace agent.", + "wick-automate skill + tools/wick-observer.mjs — detect task repetition in the work stream and propose the right automation: a deterministic PROGRAM or a judgment SKILL (or both). Stability gate + payoff estimate + program-vs-skill classifier; proposes, never auto-builds. Observer PostToolUse hook logs to memory/.observations.jsonl for cross-session mining. Offered proactively via CLAUDE.md when a task repeats >=3x.", ".github/workflows/ — public-readiness scan and skills-spec validation run on every PR + main push", "SECURITY.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md — governance hygiene for a public MIT repo" ],