Commit Graph

62 Commits

Author SHA1 Message Date
Paul O'Reilly
ee9630a9e5 CLAUDE.md: mm-worktree-task now runs MiniMax M3.1-Flash-Preview (effort max, --m3 for M3) 2026-10-13 10:25:31 +13:00
Paul O'Reilly
bbce7b2bf8 end-session: 2026-10-13 log, context, README
Claude-Session: https://claude.ai/code/session_01SCd4vYV3ig6CpcPV9PCsC6
2026-10-13 10:02:12 +13:00
Paul O'Reilly
11ee50e9c7 claude-sessions: default new session to cwd project, attach after new/resume
Claude-Session: https://claude.ai/code/session_01SCd4vYV3ig6CpcPV9PCsC6
2026-10-13 10:01:31 +13:00
Paul O'Reilly
6b4dea5ffb end-session: session lifecycle management infrastructure
- claude-sessions: registry manager with list/recover/spawn/resume/register/gc and interactive menu
- claude-sessions-shutdown: graceful systemd shutdown handler
- install-systemd.sh: idempotent service installer for new machines
- config/systemd/user/claude-sessions-save.service: versioned service definition
- README + CONTEXT updated
2026-10-12 16:24:30 +13:00
Paul O'Reilly
53170c320e feat: add systemd service config and install script
config/systemd/user/claude-sessions-save.service: source of truth
for the shutdown service, version-controlled alongside the scripts
it calls.

scripts/install-systemd.sh: idempotent install script — copies the
service file to ~/.config/systemd/user/, reloads the daemon, and
enables + starts the service. Run on any new machine to wire up
graceful Claude session shutdown.
2026-10-12 16:11:18 +13:00
Paul O'Reilly
2335a73a02 feat: claude-sessions lifecycle manager + shutdown script
claude-sessions: session registry manager with subcommands:
  - list: live tmux sessions + resumable registry entries
  - recover: scan profile dirs for sessions active before restart
  - spawn/resume: start or resume sessions
  - register: called by claude-tmux to auto-populate registry
  - gc: prune stale entries and backfill session IDs from .jsonl
  - (no args): interactive numbered menu

claude-sessions-shutdown: called by systemd at halt/reboot;
  sends /exit-session to each Claude tmux session, waits up to
  90s for graceful exit, force-kills stragglers.

Symlinks: ~/sbin/claude-sessions, ~/sbin/claude-sessions-shutdown
2026-10-12 15:47:02 +13:00
Paul O'Reilly
77a066edd2 Add skill-supervise memory doc and index entry 2026-10-01 19:49:46 +13:00
Paul O'Reilly
36dfa13b02 gitignore: .claude/ — agent worktrees must never be committed
Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
2026-09-23 19:56:56 +12:00
Paul O'Reilly
2539915a5c Merge U-H2: shell lint that fires, and three checks shellcheck lacks
formatters/sh no longer exits 0 in silence when shfmt/shellcheck are absent —
that silence was the same swallow pattern the linter exists to catch.

Adds SETE-1 (executable script with no set -e), SETE-2 (sh/bash -c with
multiple commands and no set -e inside) and LEAK-1 (secret-named file read into
a string passed to echo/printf/die). Verified against the real defects: SETE-1
and SETE-2 both flag the actual pre-fix sync-deps; LEAK-1 flags the actual
kv-put credential leak. Neither fixed script is flagged.

Supervisor fix on top: SETE-2 was matching line by line and missed the
multi-line sh -c form, i.e. the exact bug it was written for.

Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
2026-09-23 19:49:46 +12:00
Paul O'Reilly
dda01ebeca formatters/sh: SETE-2 must scan the whole file, not line by line
SETE-2 matched `sh -c "..."` with a per-line regex requiring both quotes on one
line. The shape that motivated the check spans lines:

    sh -c "
        hugo mod get ...
        hugo mod tidy
    "

so the real sync-deps bug — the one this check exists for — was never flagged.
Verified against the actual pre-fix sync-deps: now reports at line 358,
"4 commands and no 'set -e' inside".

Scans the file text with re.DOTALL and reports the line of the match start.
Falls back to counting non-blank lines when the body is newline- rather than
;-separated, which is what the multi-line form looks like.

Adds both regression cases (multi-line without set -e must flag; multi-line
with set -e must not). Verified they go red when the whole-file scan is
disabled. Neither of the two fixed real scripts is flagged.

Note for whoever extends this suite: fixtures written with a heredoc inside it
did not behave; the printf form does. Both new tests use printf.

Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
2026-09-23 19:49:33 +12:00
Paul O'Reilly
18861089bf feat(formatters/sh): surface missing shfmt/shellcheck + add SETE/LEAK checks (U-H2) 2026-09-23 19:43:51 +12:00
Paul O'Reilly
59063ddfe9 Merge U-H3: PreToolUse Bash guard for pipe-masked exit status
Supervisor-verified against the two real commands that produced false 'pushed'
messages earlier today (both flagged, rc=2), and against six legitimate
commands from the same session including a correct 'set -o pipefail' form
(none flagged). Advisory only — exit 2 feedback, never blocks.

Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
2026-09-23 19:43:05 +12:00
Paul O'Reilly
52a76ba0e3 hooks: PreToolUse Bash guard flags masked exit status (U-H3)
PreToolUse hook for the Bash tool. When the user writes a pipeline whose
left side changes state (git push, kubectl apply, curl -X PUT, ...) and
whose exit status is then consumed by && / || / an if-condition, the
hook exits 2 and surfaces an advisory naming the masking command and
suggesting ${PIPESTATUS[0]} or dropping the pipe.

Always exits 0 on parse failure, missing python3, empty input, malformed
JSON, or anything it does not recognise — a hook that breaks Bash is
worse than the bug it prevents.

Real-process tests in hooks/tests/ feed JSON on stdin as a subprocess and
include mutation cases (six targeted matcher breakages) to prove each
assertion can actually fail.
2026-09-23 19:34:48 +12:00
Paul O'Reilly
729b065f44 hooks: MiniMax gotchas reminder (UserPromptSubmit keyword trigger)
Injects a reminder to read the project's memory/gotchas-minimax.md when a prompt mentions
MiniMax or mm-worktree-task, once per session, with the real resolved path. Supervising
MiniMax units has repeatable failure modes (claimed-green dodges, fakes-only tests, a unit
routing around a permission gate) and the write-ups only help if they are opened.

Never blocks: always exits 0 on missing jq, malformed stdin or an unwritable TMPDIR.
Installed into both custom config homes (anthropic + minimax).

Claude-Session: https://claude.ai/code/session_014KNyfHmHpMbdMrHZXDRkAp
2026-09-23 13:51:54 +12:00
Paul O'Reilly
a3eeb0d990 docs: review-loop-run script memory + review-loop skill uses it
Claude-Session: https://claude.ai/code/session_018LRh1S2bHJYhEgrMu3UJx8
2026-09-13 17:20:34 +12:00
Paul O'Reilly
aa35551d37 docs(memory): skill-review-loop — supervised delivery loop skill
Claude-Session: https://claude.ai/code/session_018LRh1S2bHJYhEgrMu3UJx8
2026-09-13 17:05:53 +12:00
Paul O'Reilly
b6c976a00b chore: end-session — log, gac token correction in CLAUDE.md, FUTURE offload targets
Claude-Session: https://claude.ai/code/session_01Ku87DDWwbJkTx6SuV3sQDc
2026-09-11 13:56:44 +12:00
Paul O'Reilly
df243cd953 docs: memory + usage docs for review-minimax and ci-triage-minimax offloads
Four memory docs (2 skills, 2 wrapper scripts) + MEMORY.md index lines;
ask-minimax-usage.md gains both delegation targets. Records the gac
v0.0.2.10 token-discovery gap (needs GITEA_TOKEN_FILE pointed at
ai_admin/token; the wrapper defaults it).

Claude-Session: https://claude.ai/code/session_01Ku87DDWwbJkTx6SuV3sQDc
2026-09-11 13:48:22 +12:00
Paul O'Reilly
bb03070e69 chore: end-session — log, clear stale CONTEXT block, FUTURE idea
Session log for the explore-minimax build; remove stale 2026-06-12
unpushed-commits block (all six repos verified in sync); FUTURE entry for
extending /explore-minimax to more modes and parallel sweeps.

Claude-Session: https://claude.ai/code/session_01Ku87DDWwbJkTx6SuV3sQDc
2026-09-11 11:38:25 +12:00
Paul O'Reilly
468d75b224 docs: explore-minimax memory + ask-minimax usage update
Add /explore-minimax and explore-minimax-run memory files, backfill
skill-ask-minimax / skill-ask-minimax-with-context entries, index them in
MEMORY.md. ask-minimax-usage.md gains the exploration use case and an
explicit no-secrets rule.

Claude-Session: https://claude.ai/code/session_01Ku87DDWwbJkTx6SuV3sQDc
2026-09-11 11:33:52 +12:00
Paul O'Reilly
ed9c2986c2 docs: prefer mm-worktree-task for subagent coding tasks in planner-backed projects
Claude-Session: https://claude.ai/code/session_015nXvGNNNixJPFwZKZHNyha
2026-09-11 09:57:43 +12:00
Paul O'Reilly
de0c5ecf0a feat(status): mirror topic into tmux status bar
set-topic.sh now renames the tmux session to the project part of the
topic and stores the full topic in @claude_topic when run inside tmux.
Pairs with ~/.tmux.conf status-right showing #{@claude_topic}.

Claude-Session: https://claude.ai/code/session_01Xt2b3uQtakYGhH5Y653vwd
2026-09-09 11:54:18 +12:00
Paul O'Reilly
916acd39e1 docs(memory): add /spawn-session skill reference
Per the skill convention, document /spawn-session (purpose, usage, how it
wraps claude-tmux, gotchas) and index it in MEMORY.md.

Claude-Session: https://claude.ai/code/session_014oa7T7z1h5n34vu8vX9zGT
2026-07-25 16:29:46 +12:00
Paul O'Reilly
5623f75c3b docs: impeccable skill maintenance/install reference + CLAUDE.md pointer row
Claude-Session: https://claude.ai/code/session_01DTLFEx7r7AKsLerGtsnu8g
2026-07-23 09:39:51 +12:00
Paul O'Reilly
091fae73e8 Pre-flight: check ssh-add -l before asking user to load a key
Keys are often pre-loaded. Added explicit check-first guidance and
a note to use grep -i (case-insensitive) — a case-sensitive grep
will silently miss keys whose comments use different capitalisation.
2026-07-18 11:00:52 +12:00
Paul O'Reilly
24dcf3bcfc docs: update ask-minimax-usage.md model reference to M3
Claude-Session: https://claude.ai/code/session_01XtWRazqRbMnMRa4iV3zbVx
2026-07-17 21:22:41 +12:00
Paul O'Reilly
7838db4f26 feat(hooks): allow projects to opt out of require-plan-file check
Add a sentinel-file escape hatch: if `.claude/skip-plan-file-check`
exists in the project's cwd, the ExitPlanMode hook exits 0 without
demanding a local *-PLAN.md file.

Needed by projects (e.g. agent-runtimes) that manage plans via an
external system (work-items CP) rather than local repo files.
2026-07-12 11:40:07 +12:00
Paul O'Reilly
b41677f831 CLAUDE.md: add Gitea CI visibility section pointing at gitea-agent-companion (gac --help) 2026-07-07 17:52:19 +12:00
Paul O'Reilly
d547fe08e0 distill: fix + expand tracked-project list in settings.yaml
Correct two stale paths (octopus/customers/{duel-image,slb} -> octopus/{duel-image,slb})
and add 5 previously-untracked projects to distill scope: agent-runtimes-deploy,
cluster-apps/agent-runtimes, hugo-gabby-oreilly-counselling-content,
hugo-oreillyconsulting-integration, octopus/policy-demo.
2026-07-02 15:59:08 +12:00
Paul O'Reilly
d13beca5d7 docs: insights-driven guardrails — SSH pre-flight, bash safety, infra approval, dispatch pre-flight, session end, ask-minimax fallback 2026-06-12 21:37:26 +12:00
Paul O'Reilly
f41c22d0ac Add question-reframing guidance to CLAUDE.md; commit accumulated project files
- CLAUDE.md: add "Question the question" and "One clarifying question" rules
  to Tone and Interaction — XY problem detection, false premise checks, and
  explicit reframe pattern before answering
- Add claude/ detail-file directory (topic docs referenced from CLAUDE.md)
- Add ABOUT.md, FUTURE.md
- Update memory/, scripts/, settings.yaml with accumulated session changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:37:28 +12:00
Paul O'Reilly
6dfa20c47c End-of-session: transcript tracking log, context update, README docs
- Add session log (2026-04-13) covering transcript backup tracking system
- Add context/transcript-tracking.md: first-run verification checklist for
  the Sonnet subagent path in /log
- Update CONTEXT.md with transcript tracking entry
- Update README.md: document extract-transcripts.py and list-transcripts-here.sh;
  note that install-hooks.sh now covers skill-helper scripts too
- Prune 3 reflected logs older than retention_days (7): 2026-03-23, -25, -29

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:09:22 +12:00
Paul O'Reilly
6fd0dac218 Add transcript backup tracking system and pre-compact hook improvements
- pre-compact-backup.sh: derive transcript path from session_id+cwd (no
  longer relies on transcript_path field that Claude Code stopped providing);
  register each backup in tracking.json after saving
- extract-transcripts.py: new script managing tracking.json — register,
  list, extract conversation text, mark-processed modes
- list-transcripts-here.sh: thin wrapper for extract-transcripts --list
  using $(pwd); needed because SKILL.md bang commands reject $() substitution
- install-hooks.sh: now also symlinks skill-helper scripts into
  ~/.claude/scripts/ via a curated SKILL_HELPERS list
- Memory docs: new script-extract-transcripts.md, script-list-transcripts-here.md;
  updated skill-log.md, script-install-hooks.md, MEMORY.md index

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:06:09 +12:00
Paul O'Reilly
52b0f2b5c6 Add session log and reflect: API design research session
Session log for 2026-03-29 covering API/LLM security research, agent-runtimes
audit, and review skill creation. Reflected into:
- decisions.md: best-practices topic split, review skills read-only design
- process-lessons.md: background agents for research, Edit context
  disambiguation, best-practices repo location

Pruned 2 old reflected logs (2026-03-17, 2026-03-18).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 11:22:37 +13:00
Paul O'Reilly
884b416d38 Add memory files for review-plan and review-spec skills
Skill documentation for the new plan/spec review skills. Each file
covers purpose, usage, how it works, referenced best practice files,
and gotchas.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 11:11:35 +13:00
Paul O'Reilly
3b32ee194b Add git pull before planning work to session start flow
Projects are now worked on from multiple machines and by container
agents, so local state can be behind the remote. Pull with --ff-only
on project entry and warn if it fails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:51:38 +13:00
Paul O'Reilly
cace9600ca Migrate best practices to skynet/best-practices repo
Remove all best-practices topic files and .distill-state.json from
claude-foundations. BESTPRACTICES.md now redirects to the standalone
repo at ~/dev/claude/projects/best-practices/. Remove the now-unnecessary
sync-best-practices.sh script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:48:51 +13:00
Paul O'Reilly
25918bf028 Add database selection best practice: SQLite is not a production database
Hard rule: any service with a FQDN, multiple consumers, or concurrent
access MUST use PostgreSQL from day one. Documents the cost of "we'll
migrate later" based on the Gitea SQLite→PostgreSQL migration that cost
nearly a full day of productivity.

Extracted from cluster-bootstrap gitea-scaling session (2026-03-28).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:23:22 +13:00
Paul O'Reilly
d4eafeb38e Add security architecture best practice: server boundary rule
No server-side credential may cross the server boundary to the client.
The only credentials that cross are the client's own identity (MFA, OIDC, etc.).

Covers: proxy + identity mapping pattern, defense in depth layers,
anti-patterns (browser tokens, shared service accounts, embedded keys),
presigned URL exception for direct uploads, CMS real-world example.

Extracted from hugo-accelerator M4 where this principle drove the
CMS proxy architecture (Authelia + per-user Gitea tokens server-side).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:23:22 +13:00
e78bf5a936 Merge pull request 'Reference skynet/best-practices repo' (#1) from agent/cf-bp-redirect into main 2026-03-27 23:21:21 +00:00
agent-runtimes-bot
cc54064754 Reference skynet/best-practices repo, add sync script 2026-03-27 22:07:06 +00:00
Paul O'Reilly
1b5e73dc54 Distill best practices from agent-runtimes M1-M3 memory files
12 additions/updates across 5 best-practice files:
- docker-uid-matching: userdel simplification, SSH agent socket UID match
- debugging: GIT_SSH_COMMAND scope limitation
- test-driven-development: subprocess mock gotcha, routing callables,
  Pydantic v2 field_validator defaults, sys.exit at module level
- spec-driven-development: multi-agent orchestration practices (commit WIP,
  self-verify, import conventions, assembly budget)
- validation: test pre-commit hooks after adding dependencies

Source: agent-runtimes/memory/ (decisions, gotchas-docker, gotchas-python,
process-lessons, m1/m2/m3 reflections)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:11:54 +13:00
Paul O'Reilly
e7c8214499 Add statusline scripts, context-load improvements, and prior distill updates
- Add statusline.sh and set-topic.sh for per-session status line topics
- Update context-load with improved directory walking and output format
- Update CLAUDE.md with status line docs and early-call safety note
- Update MEMORY.md and README.md with new script/skill entries
- Add memory files: script-statusline, skill-decompose, skill-orchestrate, gotchas-gitea
- Add networking.md best practice (nftables, systemd sockets, Docker forwarding, TLS)
- Update best practices from prior distill: documentation, kubernetes, scripting,
  secrets-management, skills-development
- Prune reflected session logs, add new session logs
- Update reflection state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:11:40 +13:00
Paul O'Reilly
6c0f2db169 Add Octopus Deploy Platform Hub knowledge base
New files:
- PLATFORMHUB.md: index for Platform Hub guidance
- platformhub/architecture.md: Git→PlatformHub→Projects model
- platformhub/ocl-syntax.md: complete OCL reference for templates
- platformhub/process-template-patterns.md: 5 proven patterns
- platformhub/gotchas.md: every error hit and how to fix it
- platformhub/api-reference.md: API vs UI capabilities
- best-practices/octopus-process-templates.md: consolidated best practices

Learned from building PlatformHub-Demo (30 microservices, 3 clouds).
Key discoveries: step templates are space-scoped (can't cross-reference),
worker_pool parameter is mandatory, publishing/sharing is UI-only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 09:54:09 +13:00
Paul O'Reilly
752fdfd82e Add Docker UID matching best practice
Pattern for matching container user UID/GID to mounted volume owner
via a gosu-based entrypoint wrapper. Covers UID conflicts (Ubuntu 24.04
ships ubuntu:1000), K8s securityContext compatibility, and alternatives.

Learned from agent-runtimes M1 where Claude Code refuses
--dangerously-skip-permissions as root.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:31:40 +13:00
Paul O'Reilly
c3557a3d97 Add formatters, hooks, memory entries and context-load improvements
- formatters/js, md, yaml: new/updated formatter scripts
- hooks/set-wezterm-profile.sh: new hook for WezTerm profile switching
- scripts/context-load: improvements from recent sessions
- HOOKS.md, MEMORY.md: updated documentation and index entries
- memory/log, memory/reference-infrastructure-docs.md: session logs and reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 10:54:49 +13:00
Paul O'Reilly
9d747199fc Require spec-driven development for multi-milestone coding projects
Add "Spec-Driven Development" section to global CLAUDE.md:
- Specs must exist before code for any multi-milestone coding project
- Always read SDD and TDD best practices at project start
- SPEC.md index + spec/ directory with numbered requirements
- Tests must reference spec requirement IDs
- Workflow: Plan → Spec → Test → Code

Also update "New Projects" section to reference the SDD requirement.

Prompted by customer-discovery project where we jumped from plan
straight to code, missing the spec step entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 00:10:19 +13:00
Paul O'Reilly
0c068ffd8b Reflect 2 session logs into topic memory files
Updated: gotchas-skills.md (+$VAR paths, $() subshells, relative path
resolution), decisions.md (+CLAUDE_PROJECT_ROOT, settings.yaml relative
paths), process-lessons.md (+research history before building validators).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 11:22:35 +13:00
Paul O'Reilly
fae2f86063 Add session log and minor CLAUDE.md update
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 11:17:15 +13:00
Paul O'Reilly
73f9c986a8 Add housekeeping skill memory file and update index
Documents the /housekeeping skill: purpose, usage, how it works,
and which scripts it orchestrates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 11:17:10 +13:00