afaraha8403/mental
Never reconstruct where you left off. Local-first continuity for you and your coding agents — resume, decisions, and what's still in the air. CLI, MCP, and Agent Skills for Cursor, Claude Code, Copilot, and Codex.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
[0.10.2] - 2026-09-09
Fixes
- Unbound
search,list, andshowno longer walk every home project under~/.mental/projects. Until a write creates a UUID, glance returns an empty catalog (showis not-found). Leftover./.mentalstill imports only on write.mental pulseremains the cross-project view.
[0.10.1] - 2026-09-08
Features
mental track stop --billable suggestedrecords glancesuggested_billable(elapsed to last heartbeat) instead of requiring the caller to copy that value by hand.
Fixes
mental track reportincludes running intervals with live wall and always emitswall_minutesplusrunning/running_minutes, so an unstopped clock is not a silent zero.mental doctorwarns on a stale running interval (idle since last heartbeat) instead of listing it as a healthy info line.--accept-staleis a no-op, including under--json, so a hook or timer can pass it.stopalready worked without the flag.
[0.10.0] - 2026-09-07
Features
mental doctor --fixapplies safe repairs only: recopies home skills/rules, purges leftover Balakit Mental wiring, and adds global git excludes. It does not write project.cursor/rules, does not enable hooks/MCP/track, and does not update npm or host plugins. After doctor, agents re-runmental doctor --json, thenmental doctor --fix --jsononce if needed, and ask before--projector optionals.- Doctor TTY and JSON print a portable
next:command (mental doctor --fix,mental install --project,mental-repair/mental-repair.cmd, ornpm i -g). ASCII only, no&&, same on Windows, macOS, and Linux.
Fixes
mental doctortreats~/.cursor/rules/mental.mdcas coverage (Cursor 2.1+ loads home rules). A missing file is an error, same as Claude's~/.claude/rules/mental.md. Project.cursor/rules/mental.mdcstays a warning for Cloud/CLI. TTY prints ⚠ for failed warn checks and ✖ only for errors, so warn-only still ends withdoctor clean.
[0.9.1] - 2026-09-06
Fixes
mental installwrites the always-on rule to each host's documented path:~/.claude/rules/mental.mdplus the CLAUDE.md managed block,~/.codex/AGENTS.md, and~/.config/opencode/AGENTS.mdwhen that file already exists. Cursor still gets~/.cursor/rules/mental.mdc(not natively loaded) and a project.cursor/rules/mental.mdconmental install --project.mental doctorfails when a load-true host file is missing and warns that Cursor global rules are not natively loaded.mental uninstallremoves each destination and deletes a leftover empty AGENTS.md/CLAUDE.md so OpenCode can fall back to CLAUDE.md.
[0.9.0] - 2026-09-01
Features
mental-repairprovides a one-time, unshadowed migration path for existing Windows installs. It fingerprints Mental 0.7/0.8 launchers under~/.local/bin, quarantines only owned files, preserves unknown paths, verifies npm's current launcher, and restores the quarantine if verification fails.
Changes
-
npm is the sole owner of the
mentalexecutable. Fresh installs use the samenpm i -g,mental install, andmental doctorcommands in PowerShell, cmd.exe, Windows Terminal, Git Bash, macOS, and Linux.mental installnow installs skills/rules/config only; it no longer self-updates, performs a second global npm install, or writes duplicate PATH launchers. Existing Windows installs from 0.8.1 or older runmental-repair.cmdonce. Strict PowerShell policies can use npm's.cmdlaunchers. -
Node.js 22.13 or newer is now required, matching the unflagged
node:sqliteruntime used by Mental Track.
Fixes
- CI and the Release workflow run the full tests plus install recipes on Ubuntu, macOS, and Windows before publish. Windows verifies npm's
.cmdlauncher and barementalfrom PowerShell, cmd.exe, and Git Bash. Dirty-profile tests cover rollback-safe 0.7/0.8 launcher repair. Paths canonicalize via native realpath; export--outwalks NTFS identity so an 8.3 short-name destination inside the worktree is still refused. Lockstep file keys remain POSIX.
[0.8.1] - 2026-08-31
Fixes
- Windows install/upgrade no longer leaves a
mentalsymlink (or raw copy) that ShellExecutescli.mjs— the "how do you want to open this file?" dialog.mental installnow writesmental.cmd,mental.ps1, and a Git Bash shim in both~/.local/binand the npm prefix, and deletes the leftover link 0.7.x created. Agent paste and the setup skill no longer namecli.mjsas a command (that path is what agents ran). Developers on a git checkout usenpm run mental -- install.
[0.8.0] - 2026-08-30
Features
- Track automatically records AI-generated private and customer-ready title/body fields alongside wall and billable time. Start is ensure-running;
--newstarts another clock. Park, journal, and handoff refresh the customer copy and default billable to wall in the same command. Missing copy returns a renderer-safe single-select question (id, plain prompt, short{ id, label }options,allow_multiple: false) with numbered-text fallback. Dated external exports contain customer descriptions, wall, and billable while omitting private detail. Existing user-time values migrate to first-class billable columns;--userremains a compatibility alias.
Changes
- README, install, CLI, agents, why, and the agent procedure describe automated time capture, low-friction defaults, native structured questions only for genuine ambiguity, and steerable customer copy.
Fixes
-
Never-started is short wall (start → now under 2 minutes), not
last_seen ≈ started. Overnight leftover still flagsstale_stopwithout wiping user. Overlap detection treats a running interval as open through now. -
Update notice learns a new npm version within 24h when this CLI thinks it is current. The 7-day cache applies only while already behind. TTY prints the hint once per day;
--jsonstill includesupdateon every call. Failed npm lookups back off instead of retrying every command. Prerelease sorts below the matching release. -
Windows install no longer ShellExecutes
.mjsfiles (the "how do you want to open this file?" dialog).mental installwrites amental.cmdshim that runsnode, and self-upgrade re-invokes viaprocess.execPath. The agent paste leads withnpm i -gand forbids running.mjsas a command.
[0.7.1] - 2026-08-29
Features
mental decidecreate requires--body(the why). Same--titlewithout--bodystill updates. Decision files are title plus body — no Context/Options/Outcome placeholders.- Search JSON includes
tokensandop(andoror). Space-separated words are AND prefixes unless--any. MCPqmay be a string array (union of queries). Quotes are not a phrase operator. - Journal hops (
## HH:MM — title) index as their own search rows (journal/YYYY-MM-DD.md#HH:MM).mental showthat path returns the section.liststays one file per day. - Search ranks Decision, then Note, then Attention, then Journal.
- Heartbeat TTY splits Later (
attention --status later) from In the air. JSON addslater/laterCount. "Come back to this" / "note that for later" is this status — not a note.
Fixes
- Attention create no longer writes
<why this would cost a reload if forgotten>into the file. Title-only residue is allowed.
Changes
- Skill and always-on rule: before proposing a flag, crate, or approach, search that name; rejected approaches are Decisions with a searchable title. Journal is not the graveyard of failed ideas.
- Skill and rule: "come back to this" / "for later" →
attention --status later --kind thread. Nevernotefor leftovers. - Existing users upgrade with
npm i -g @balacode/mentalthenmental installthenmental doctor. Agent paste no longer skips those steps when Mental is already on PATH. Search index rebuilds on the next search; journals stay. Host plugin is a second channel. - Agent install paste names
skills/mental-setupvsskill/mental, fail-open, and no plugin MCP. README and install-doc pastes stay identical. - Official product name is Mental CLI (short forms Mental /
mental). Docs and agent skill/rule copy; binary, npm package, and repo staymental. - Official slogan is I type mental. Landing docs; npm/plugin descriptions still lead with the continuity promise.
[0.7.0] - 2026-08-28
Features
- Plugin skill is a CLI bootstrap (
skills/mental-setup/). The full procedure lives inskill/mental/and is copied bymental install.
Changes
- Native plugin no longer auto-starts clone MCP from
mcp.json/.mcp.json. Usemental install --mcpfor PATHmental serve. Breaking for plugin-only MCP users.
0.6.0 - 2026-08-28
Features
- Single command catalog drives grouped help,
mental schema --json, shell completions, and MCPinputSchema. Groups: Daily, Lookup, Write, Identity, Setup. - Progressive help:
mental -his Daily (one screen);mental --helpis all commands grouped;mental <cmd> --helpandmental help <cmd>show that command with examples first, required vs optional, and enums. mental schema --jsondumps the catalog (no auth, no network).mental schema <cmd> --jsonis one command.mental completion bash|zsh|fishprints a completion script from the catalog (does not write shell rc files).mental --jsonwith no command is a heartbeat (exit 0). Non-TTY no-args without--jsonstill prints help and exits 2.- Unknown flags fail (exit 2,
unknown-flag) instead of becoming silent booleans. Hint lists legal flags for that command. - POSIX
--ends option parsing (mental search -- -labelis a query, not a flag). - JSON errors include
error.hint(copy-paste next argv). Usage failures exit 2. Human errors go to stderr;--jsonstays on stdout. doctor --jsonsetsok: falsewhen process exit is 3 (error-level problems). Warn-only staysok: true.list/searchJSON includetruncatedandtotal(default cap 50).- Heartbeat JSON includes
idandmodeso agents can skip awhereround-trip. mental heartbeat --json --fields resume,attentionmasks keys.--fieldswith no value lists legal names.--plain/--no-color, plusNO_COLOR(any non-empty) andTERM=dumb: no emoji, no ANSI.MENTAL_ASCIIstill strips emoji only.- TTY heartbeat footer:
more · mental doctor · mental search · mental --help. - TTY-only “did you mean” for unknown commands. Never auto-run.
--jsonhard-fails withunknown-commandand a Daily hint.
Fixes
journalrequires--resume(no silent “Continue” default). Aligns with park/handoff and the skill.
Changed
- Agent install paste tells the host to use only this client's plugin flow (do not run other hosts'
/plugin/copilot plugin/ Command Palette steps). - Human install docs match Cursor Customize / local symlink, Claude slash vs CLI, and Copilot shell. No GitHub URL
/add-plugin. - Skill points agents at
--help/schemainstead of inlining a flag table (skills/mental/references/cli.md). Procedure stays in SKILL.md. - MCP
inputSchemais generated from the catalog for the existing session subset (identity and setup stay CLI). Journal MCP acceptsagainst. Closed enums forkind/statuswhere the CLI already has them.
0.5.1 - 2026-08-28
Changed
- Release workflow publishes with
secrets.NPM_TOKEN(NODE_AUTH_TOKEN) andsetup-noderegistry-url.workflow_dispatchcan republish HEAD when git tagv$(package.json version)already exists. Agent rule: a release is not done until that npm version equals the tag. - Agent install paste no longer includes in-repo release lockstep. After doctor, agents ask about optional hooks and time tracking, and whether MCP is needed, with a one-liner for each. Still wait for yes this turn.
0.5.0 - 2026-08-28
Added
- Optional time tracking as an isolated, default-off add-on. Hours live in bundle
time.sqlite(never git, never the FTS cache). Durations are wall (sum of in-session elapsed) and user (human time inside that wall), rendered ash:mm.mental optionflags track (per UUID), MCP, and hooks in~/.mental/config.json.mental trackstart/stop/focus/discard/report/export. Heartbeat--jsonmay include a compactdata.tracksibling (ids only, no titles or hours); TTY heartbeat and pulse stay freeze without a timesheet. Park/handoff stop the focused interval only. The track skill lives inoptional/mental-track/(not pluginskills/). Install and doctor returnoptionals[]withneedsConsent: true. Agents must not enable a feature unless the user named it this turn. - Product version lockstep:
package.jsonis source of truth. Portableplugin.json, Cursor/Claude shims, the lockfile, and skillmetadata.versionmust match.node scripts/bump-version.mjs <semver>writes them;--check(andrelease.yml) refuse drift. Marketplace plugin entries still omitversion(Claude usesplugin.json). mental doctorwarns when a Claude Code or Copilot plugin, or a copied skill, is behind this CLI. Probesclaude plugin list --json/copilot plugin list --json(fail open if missing). Does not write host plugin caches.MENTAL_SKIP_HOST_PLUGIN_CHECK=1skips.
Changed
- Skill
metadata.versionnow tracks the product version (was1.0.0). Native plugin install is documented as a second channel:mental installrefreshes CLI + skill copies, not the host plugin UI.
0.4.1 - 2026-08-27
Added
- Every
--jsonenvelope may include anupdatesibling (current,latest,hint) when npm is ahead of this CLI. Agents tell the user once and suggestmental install. TTY prints the same hint. Backed by a 7-day cache under${XDG_CACHE_HOME:-~/.cache}/mental/npm-latest.jsonso ordinary commands nevernpm view;MENTAL_SKIP_UPDATE_CHECK=1still skips.doctor/installstill check live.
Fixed
- GitHub Release workflow no longer sets
setup-noderegistry-url. That wrote a dummyNODE_AUTH_TOKENand made npm skip OIDC trusted publishing (E404), so0.3.1and0.4.0never landed on the registry.
0.4.0 - 2026-08-27
Added
- Attention kind
verify— “agent produced this, human has not looked.” Heartbeat lists it first under Needs eyes. Cap still 7. Not a review queue. Hopson the TTY pulse = parks today (hopsToday).delta.parksstays since-last-pulse. Makes stealth switching visible without analytics.- Settled on heartbeat: newest decided titles (cap 7, no bodies) so the next agent does not re-litigate.
--via <token>on journal / park / handoff / attention / decide — short client token (cursor,claude-code,copilot,codex,mcp,cli). Rejects emails, URLs, paths, and session ids.
Changed
- Ship a 256×256 PNG mark (
assets/logo.png, ~29KB) instead of the 262KB traced SVG. README and Cursor plugin point at the PNG; the SVG is not in the package. - README “Why this exists” and docs/research.md now cite 2024–2026 agent-era studies (verification load, supervisory engineering, stealth context switching, the productivity–experience paradox) instead of 1998–2011 interruption papers as the primary proof. The ready-to-resume mechanism still maps to
park/handoff.
0.3.1 - 2026-08-27
Changed
- New Mental mark (
assets/logo.svg) on the README and Cursor plugin. Editor chrome stripped; portableplugin.jsonstill has nologofield (schema is closed).
0.3.0 - 2026-08-27
Added
mental park --resume— encode continuity at an interruption (default journal title"Parked"), optional attention in the same call, then heartbeat. For mid-hop context switches, not only planned closes.mental handoff --title --resume— planned task-boundary sugar: journal then heartbeat in one shot.mental pulse— compact cross-project rows frombindings.json(resume + residue/decision counts, no journal bodies) for multi-repo orchestration.- Since-last-pulse delta counts on heartbeat / pulse / park / handoff (
${XDG_CACHE_HOME:-~/.cache}/mental/<uuid>.pulse.json). Heartbeat stays read-only for the watermark; writers refresh it after computing the delta. - Open-decision budget mirrors attention (cap 7 on heartbeat TTY and JSON;
attentionCount/openDecisionCount; doctor warns when over). - Doctor warns (exit still 0 if only warns) for attention and decisions left open/later/deferred longer than 14 days (
--daysoverride). - First-class README: landing-page promise, measured numbers, and a docs hub (
docs/why.md,install.md,cli.md,agents.md,identity.md,benchmarks.md,research.md). - README research section + docs/research.md: Parnin/Rugaber resumption lag, Leroy attention residue, Mark interrupted-work stress — mapped to heartbeat,
Resume:, and attention. - Reproducible micro-benchmarks via
npm run bench(scripts/bench.mjs) — CLI vs in-process heartbeat and search at 100 / 500 / 2,000 notes.
Changed
- Agent Mental receipt is a markdown bullet list:
🧠 **Mental**then- emoji **Kind** › *action* › title. No────────wrapper. Actions (italic, lowercase): Journal/Noterecorded; Attentionrecorded/resolved; Decisionopened/decided; Readheartbeat/pulse/searched/showed/listed. - README is a landing page. Depth (install edge cases, full command table, Agent Plugins, remap) lives in
docs/. - SQLite index still writes
concepts+linkswhen Node’snode:sqlitehas no FTS5 module. Search uses LIKE with title-first ranking; FTS5 + bm25 remains the path when the module exists.INDEX_VERSIONis 3 so older caches rebuild. - Discovery metadata for AI-tooling developers: npm
keywords+ author, plugin/marketplace keywords, skill tags (coding-agents,mcp,cursor,claude-code, …), and a README subtitle / works-with row (Cursor, Claude Code, Copilot, MCP, Agent Skills). - README Who writes — agents journal / decide / record residue after
mental install; humans are not expected to keep the log by hand. Same CLI if you want the pulse yourself. Not a hidden hook; not every chat turn. - README rebuilt on the award-style 3-tier layout used by uv / Aider / Goose / Mem0: pitch + demo + quick start above the fold; highlights; who-writes table; research as proof not a lecture; FAQ for agents and humans; depth stays in
docs/.
Fixed
mental park --attentionupserts by title likemental attention(same-day retry no longer crashes after the journal write).mental pulsereads opted-in./.mentalforstore=localbindings instead of a stale home slice.- Heartbeat decision cap keeps the newest open/deferred decisions (same newest-first order as attention).
- Pulse watermark writes fail open so an unwritable cache cannot fail park/handoff after a successful journal.
0.2.3 - 2026-08-26
Added
mental doctorchecks npm for a newer@balacode/mental(warn only; fail open).mental installfrom a published install upgrades the global CLI when npm is ahead, then re-runs so skills match.MENTAL_SKIP_UPDATE_CHECK=1skips the network. Heartbeat never checks.
Changed
- Agent Mental receipt wraps with a separator line (
────────) instead of</br>, which printed as literal tags in Claude Code and other agents.
Fixed
mental install/npm i -goverwrites an existing globalmentalbin (npm 11 EEXIST). Leftover@mental/clilinks no longer block@balacode/mental.
0.2.2 - 2026-08-26
Added
mental installfinds leftover Balakit Mental skill/rule copies (fingerprint:npx balakit doctor,mentalDataPolicy, …) and deletes them before writing the standalone skill. Mental-only<!-- BEGIN balakit -->blocks are stripped. Journals and./.mentaldata are not deleted.mental doctorwarns if any remain.
0.2.1 - 2026-08-26
Changed
- Agent Mental receipt wraps with
</br>, uses a markdown hard break after🧠 Mental, and prints indentedKind: Verblines so Cursor chat does not collapse the block onto one line.
0.2.0 - 2026-08-26
Added
- Ranked FTS search (
bm25) with snippets, and SQL-side--type/--status/--tag/--kindfilters so a typed query cannot be crowded out by untyped matches. mental listincludes each concept'sdescription;--kindfilters attention on list and search.mental showreturnsbacklinksfrom the derived link index (file-scan fallback).- MCP
listtool; search accepts the same typed filters as the CLI; tool results are compact JSON. - Agent Mental receipt at the end of a turn that used the CLI:
<br>, title🧠 Mental, then type lines (📓 journal, 🚦 attention, 🎯 decision, 📝 note, 🔍 read). Example in the skill; the always-on rule points at it. TTY writes use the same type emojis.--jsonstays ASCII (MENTAL_ASCII=1strips emoji). mental installcopies the skill to~/.config/opencode/skills/mental(OpenCode).
Changed
- README now shows the logo, npm (
@balacode/mental), Agent Plugins 1.0.0 packaging, and copy-paste install prompts for Cursor, Claude Code, VS Code, and GitHub Copilot. - npm package is
@balacode/mental(unscopedmentalis taken). The CLI bin staysmental.
0.1.0 - 2026-08-26
First public release of the Mental CLI.
Added
- Standalone Mental CLI: on a TTY, no args prints a one-shot heartbeat and exits; named commands are one-shot; agents use
--json. - UUID identity in
~/.mental/bindings.json, withremap/split/linkandlocal --import/--move. - Attention residue (
mental attention) andjournal --againstso heartbeat carries what is still in the air. - Agent Plugins 1.0.0 package: root
plugin.json, skill atskills/mental/, MCP atmcp.json(stdio./bin/cli.mjs serve). - Cursor / Claude Code shims:
.cursor-plugin/plugin.json(SVG logo) and.claude-plugin/plugin.json(displayName: Mental). install --mcpregistersserve;decideupdates by title so an open decision can close.- Install, doctor, uninstall; hooks stay off by default.