From 2ffb3a8b1e3062fe4b18c97901f2b9986e0505e8 Mon Sep 17 00:00:00 2001 From: KeiSei84 <2206745@gmail.com> Date: Mon, 25 May 2026 15:00:07 +0800 Subject: [PATCH] chore(public-prep): scrub author identity + private-IP references Pre-public Phase 1. Remove personal/IP traces that should not ship in a general-purpose kit; keep only intended author attribution. - no-github-push.sh + hooks-and-blocks.md + ci-scaffold: drop "KeiTech unfiled patent IP / trade secrets / priority date" wording; reword as a generic opt-in guard for keeping code on a private remote. - check-error-patterns.sh: remove author-local absolute path from the tombstone comment. - graph-export-watcher.sh: default viz dir to ~/.local/share/kei/graph-viz (was a personal project path). - agent manifests (cost-guardian, modal-runner, infra/ml/code-implementer) + ci.yml: strip private memory references and dated personal incidents; keep the generic cost/ops lessons. Snapshots regenerated; golden 3/3. Kept intentionally: author attribution (NOTICE / README / Cargo / plugin). Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 2 +- .../fixtures/_manifests/code-implementer.toml | 2 +- .../fixtures/_manifests/cost-guardian.toml | 2 +- .../tests/snapshots/code-implementer.snap | 2 +- _assembler/tests/snapshots/cost-guardian.snap | 2 +- _generated/code-implementer.md | 2 +- _generated/cost-guardian.md | 2 +- _generated/infra-implementer.md | 6 +++--- _generated/ml-implementer.md | 4 ++-- _generated/modal-runner.md | 4 ++-- _manifests/code-implementer.toml | 2 +- _manifests/cost-guardian.toml | 2 +- _manifests/infra-implementer.toml | 6 +++--- _manifests/ml-implementer.toml | 4 ++-- _manifests/modal-runner.toml | 4 ++-- docs/encyclopedia/hooks-and-blocks.md | 4 ++-- hooks/check-error-patterns.sh | 6 +++--- hooks/graph-export-watcher.sh | 2 +- hooks/no-github-push.sh | 19 +++++++++---------- skills/ci-scaffold/phase-1-intake.md | 2 +- 20 files changed, 39 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c709db7..92820ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,7 +145,7 @@ jobs: continue-on-error: true workflow-lint: - # v0.20.1: guards against the dtolnay-SHA-class incident (2026-04-22). + # v0.20.1: guards against the dtolnay-SHA-class incident. # actionlint catches workflow syntax; validate-workflow-shas.sh catches # fabricated / force-pushed SHA pins. Runs fast (<30s). runs-on: ubuntu-latest diff --git a/_assembler/tests/fixtures/_manifests/code-implementer.toml b/_assembler/tests/fixtures/_manifests/code-implementer.toml index 8b9a220..43cba45 100644 --- a/_assembler/tests/fixtures/_manifests/code-implementer.toml +++ b/_assembler/tests/fixtures/_manifests/code-implementer.toml @@ -99,7 +99,7 @@ extra = [ "path:user-rules/dev-workflow.md", "path:user-rules/debugging.md", "path:user-rules/karpathy-behavioral.md", - "MEMORY.md → Architecture Overlay Incident (model_brain.py 227→354 LOC from \"fixes\" — never patch, fix root formulas)", + "Architecture Overlay Incident (model_brain.py 227→354 LOC from \"fixes\" — never patch, fix root formulas)", ] [taxonomy] diff --git a/_assembler/tests/fixtures/_manifests/cost-guardian.toml b/_assembler/tests/fixtures/_manifests/cost-guardian.toml index 7fd6a15..8355dce 100644 --- a/_assembler/tests/fixtures/_manifests/cost-guardian.toml +++ b/_assembler/tests/fixtures/_manifests/cost-guardian.toml @@ -13,7 +13,7 @@ You are the cost guardian. Your job is to make sure no paid compute launches wit verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop \ runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do \ NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident \ -(2026-02-26)** is the cautionary tale: prices guessed not verified, silent retries \ +** is the cautionary tale: prices guessed not verified, silent retries \ re-billing, file changes never confirmed, dashboard never checked. Every protocol below \ exists because of that day — never again. """ diff --git a/_assembler/tests/snapshots/code-implementer.snap b/_assembler/tests/snapshots/code-implementer.snap index eb9f438..6e60115 100644 --- a/_assembler/tests/snapshots/code-implementer.snap +++ b/_assembler/tests/snapshots/code-implementer.snap @@ -419,4 +419,4 @@ Blockers / next: - `path:user-rules/dev-workflow.md` - `path:user-rules/debugging.md` - `path:user-rules/karpathy-behavioral.md` -- `MEMORY.md → Architecture Overlay Incident (model_brain.py 227→354 LOC from "fixes" — never patch, fix root formulas)` +- `Architecture Overlay Incident (model_brain.py 227→354 LOC from "fixes" — never patch, fix root formulas)` diff --git a/_assembler/tests/snapshots/cost-guardian.snap b/_assembler/tests/snapshots/cost-guardian.snap index 61254f4..5b539b2 100644 --- a/_assembler/tests/snapshots/cost-guardian.snap +++ b/_assembler/tests/snapshots/cost-guardian.snap @@ -13,7 +13,7 @@ model: opus # ROLE -You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident (2026-02-26)** is the cautionary tale: prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again. +You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident ** is the cautionary tale: prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again. # AGENT SUBSTRATE — role `read-only` diff --git a/_generated/code-implementer.md b/_generated/code-implementer.md index d79ebce..ae415e3 100644 --- a/_generated/code-implementer.md +++ b/_generated/code-implementer.md @@ -463,4 +463,4 @@ behaviour-verified: yes | no | not-applicable follow-up-required: - ``` -- `MEMORY.md → Architecture Overlay Incident (model_brain.py 227→354 LOC from "fixes" — never patch, fix root formulas)` +- `Architecture Overlay Incident (model_brain.py 227→354 LOC from "fixes" — never patch, fix root formulas)` diff --git a/_generated/cost-guardian.md b/_generated/cost-guardian.md index 38407ee..b88e5e5 100644 --- a/_generated/cost-guardian.md +++ b/_generated/cost-guardian.md @@ -9,7 +9,7 @@ model: sonnet # ROLE -You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident (2026-02-26)** is the cautionary tale: prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again. +You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident** is the cautionary tale: prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again. # AGENT SUBSTRATE — role `read-only` diff --git a/_generated/infra-implementer.md b/_generated/infra-implementer.md index fa0d1b4..ac35092 100644 --- a/_generated/infra-implementer.md +++ b/_generated/infra-implementer.md @@ -438,9 +438,9 @@ Blockers / next: - `{path::user-rules}/git-conventions.md` - `{path::user-rules}/dev-workflow.md` - `{path::user-memory}/security-restricted-projects.md` -- `MEMORY.md → Compute Cost Incident (2026-02-26): $98.78 Modal overrun — no dashboard check, unverified prices.` -- `MEMORY.md → Recruiter shared-EC2 risk (i-0a8b747023809d451 shared with 3 projects, default SECRET_KEY, no CSRF).` -- `MEMORY.md → CloudSync 146 GB bloat: two duplicate LaunchAgents both writing logs. Scan for duplicates before adding infra.` +- `Compute Cost Incident: $98.78 Modal overrun — no dashboard check, unverified prices.` +- `Recruiter shared-EC2 risk (i-0a8b747023809d451 shared with 3 projects, default SECRET_KEY, no CSRF).` +- `CloudSync 146 GB bloat: two duplicate LaunchAgents both writing logs. Scan for duplicates before adding infra.` ## Output Footer (RULE 0.16) diff --git a/_generated/ml-implementer.md b/_generated/ml-implementer.md index af8b8f8..ec84ad2 100644 --- a/_generated/ml-implementer.md +++ b/_generated/ml-implementer.md @@ -483,8 +483,8 @@ Blockers / next: - `{path::user-rules}/manifold-tangent-sanity.md` - `{path::user-rules}/no-downgrade-constructive.md` - `{path::user-memory}/wrong-paths-specialized-ml.md` -- `MEMORY.md → Compute Cost Incident (2026-02-26): promised $27, spent $98.78 on Modal. NEVER AGAIN.` -- `MEMORY.md → Architecture Overlay Incident: model_brain.py 227→354 LOC from audit fixes. No Patching.` +- `Compute Cost Incident: promised $27, spent $98.78 on Modal. NEVER AGAIN.` +- `Architecture Overlay Incident: model_brain.py 227→354 LOC from audit fixes. No Patching.` ## Output Footer (RULE 0.16) diff --git a/_generated/modal-runner.md b/_generated/modal-runner.md index c93d556..13faad0 100644 --- a/_generated/modal-runner.md +++ b/_generated/modal-runner.md @@ -11,9 +11,9 @@ model: sonnet You are the Modal compute orchestrator. You launch Modal jobs safely, observe them well, and NEVER burn money or kill running work. Two incidents shape every rule below. -$98.78 Modal Incident (2026-02-26): promised $27, spent $98.78 in one session. Prices guessed not verified, failed retries silently re-billed, file changes never confirmed, dashboard never checked. Every cost rule exists because of that day. +$98.78 Modal Incident: promised $27, spent $98.78 in one session. Prices guessed not verified, failed retries silently re-billed, file changes never confirmed, dashboard never checked. Every cost rule exists because of that day. -anti-stop guard Incident (2026-03-29): stopped a 1.4-hour training run for a non-critical bug. Cost: 1.4 hours A10G + restart + re-warmup. Every kill rule exists because of that day. +anti-stop guard Incident: stopped a 1.4-hour training run for a non-critical bug. Cost: 1.4 hours A10G + restart + re-warmup. Every kill rule exists because of that day. Cost tiers: <$5 per run → AUTO; $5-$20 → WARN + daily-cap check ($20/day session); >$20 → STOP and ask. Always state estimate in dollars BEFORE launch: "Estimate: $X.XX (= N_gpus × hours × $/hr/gpu)". GPU compat: A10G torch>=2.0 (~$1.10/hr), H100 torch>=2.1 (~$4.50/hr), B200 torch>=2.6 (~$8/hr). Always verify on pricing page — rates change. diff --git a/_manifests/code-implementer.toml b/_manifests/code-implementer.toml index 8f4a938..c9d47db 100644 --- a/_manifests/code-implementer.toml +++ b/_manifests/code-implementer.toml @@ -99,7 +99,7 @@ extra = [ "path:user-rules/dev-workflow.md", "path:user-rules/debugging.md", "path:user-rules/karpathy-behavioral.md", - "MEMORY.md → Architecture Overlay Incident (model_brain.py 227→354 LOC from \"fixes\" — never patch, fix root formulas)", + "Architecture Overlay Incident (model_brain.py 227→354 LOC from \"fixes\" — never patch, fix root formulas)", ] [taxonomy] diff --git a/_manifests/cost-guardian.toml b/_manifests/cost-guardian.toml index 3130c59..259a26e 100644 --- a/_manifests/cost-guardian.toml +++ b/_manifests/cost-guardian.toml @@ -13,7 +13,7 @@ You are the cost guardian. Your job is to make sure no paid compute launches wit verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop \ runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do \ NOT launch jobs yourself (hand back to user or `ml-implementer`). **The $98.78 Modal incident \ -(2026-02-26)** is the cautionary tale: prices guessed not verified, silent retries \ +** is the cautionary tale: prices guessed not verified, silent retries \ re-billing, file changes never confirmed, dashboard never checked. Every protocol below \ exists because of that day — never again. """ diff --git a/_manifests/infra-implementer.toml b/_manifests/infra-implementer.toml index 72c8589..7b56230 100644 --- a/_manifests/infra-implementer.toml +++ b/_manifests/infra-implementer.toml @@ -100,9 +100,9 @@ extra = [ "path:user-rules/git-conventions.md", "path:user-rules/dev-workflow.md", "path:user-memory/security-restricted-projects.md", - "MEMORY.md → Compute Cost Incident (2026-02-26): $98.78 Modal overrun — no dashboard check, unverified prices.", - "MEMORY.md → Recruiter shared-EC2 risk ( shared with 3 projects, default SECRET_KEY, no CSRF).", - "MEMORY.md → CloudSync 146 GB bloat: two duplicate LaunchAgents both writing logs. Scan for duplicates before adding infra.", + "Compute Cost Incident: $98.78 Modal overrun — no dashboard check, unverified prices.", + "Recruiter shared-EC2 risk ( shared with 3 projects, default SECRET_KEY, no CSRF).", + "CloudSync 146 GB bloat: two duplicate LaunchAgents both writing logs. Scan for duplicates before adding infra.", ] [taxonomy] diff --git a/_manifests/ml-implementer.toml b/_manifests/ml-implementer.toml index 83bacdb..0325b10 100644 --- a/_manifests/ml-implementer.toml +++ b/_manifests/ml-implementer.toml @@ -113,8 +113,8 @@ extra = [ "path:user-rules/manifold-tangent-sanity.md", "path:user-rules/no-downgrade-constructive.md", "path:user-memory/wrong-paths-specialized-ml.md", # TODO verify path:user-memory exists in assembler resolver - "MEMORY.md → Compute Cost Incident (2026-02-26): promised $27, spent $98.78 on Modal. NEVER AGAIN.", - "MEMORY.md → Architecture Overlay Incident: model_brain.py 227→354 LOC from audit fixes. No Patching.", + "Compute Cost Incident: promised $27, spent $98.78 on Modal. NEVER AGAIN.", + "Architecture Overlay Incident: model_brain.py 227→354 LOC from audit fixes. No Patching.", ] [taxonomy] diff --git a/_manifests/modal-runner.toml b/_manifests/modal-runner.toml index 3df3f40..e498dd4 100644 --- a/_manifests/modal-runner.toml +++ b/_manifests/modal-runner.toml @@ -12,11 +12,11 @@ role = """ You are the Modal compute orchestrator. You launch Modal jobs safely, observe them well, and NEVER \ burn money or kill running work. Two incidents shape every rule below. -$98.78 Modal Incident (2026-02-26): promised $27, spent $98.78 in one session. Prices guessed not \ +$98.78 Modal Incident: promised $27, spent $98.78 in one session. Prices guessed not \ verified, failed retries silently re-billed, file changes never confirmed, dashboard never checked. \ Every cost rule exists because of that day. -anti-stop guard Incident (2026-03-29): stopped a 1.4-hour training run for a non-critical bug. Cost: \ +anti-stop guard Incident: stopped a 1.4-hour training run for a non-critical bug. Cost: \ 1.4 hours A10G + restart + re-warmup. Every kill rule exists because of that day. Cost tiers: <$5 per run → AUTO; $5-$20 → WARN + daily-cap check ($20/day session); >$20 → STOP \ diff --git a/docs/encyclopedia/hooks-and-blocks.md b/docs/encyclopedia/hooks-and-blocks.md index 9521f55..1535ac3 100644 --- a/docs/encyclopedia/hooks-and-blocks.md +++ b/docs/encyclopedia/hooks-and-blocks.md @@ -32,8 +32,8 @@ All hooks live under `hooks/` directory. Format: `| Hook Name | Event | Severity | Hook | Event | Severity | Purpose | Bypass Env | |------|-------|----------|---------|-----------| -| no-github-push.sh | PreToolUse:Bash | block | Prevent pushing KeiTech patent IP to github.com — destroys priority date | KEI_NO_GITHUB_PUSH_BYPASS | -| no-python-without-approval.sh | PreToolUse:Bash | block | Enforce RULE 0.2 (Rust first) — Python requires exception justification | none | +| no-github-push.sh | PreToolUse:Bash | block | Block accidental push / repo-create to github.com (opt-in; for code kept on a private remote) | KEI_NO_GITHUB_PUSH_BYPASS | +| no-python-without-approval.sh | PreToolUse:Bash | block | Optional Rust-first policy — Python requires explicit justification (opt-in, stack-gated) | none | | rust-first.sh | UserPromptSubmit | remind | Remind about Rust-first default for new work | none | | secrets-pre-guard.sh | PreToolUse:Edit\|Write | block | Detect hardcoded API keys, tokens, private keys before commit | KEI_SECRETS_GUARD_BYPASS | | destructive-guard.sh | PreToolUse:Bash | block | Block dangerous commands (rm -rf /, git reset --hard main, truncate) | none | diff --git a/hooks/check-error-patterns.sh b/hooks/check-error-patterns.sh index c125710..6be813d 100755 --- a/hooks/check-error-patterns.sh +++ b/hooks/check-error-patterns.sh @@ -1,8 +1,8 @@ #!/bin/bash # DELETED — 2026-05-02 # Reasons: -# 1. Hardcoded path leak: /Users/denis/projects/ai machine learning/error-patterns.json -# 2. RULE 0.2 violation: used python3 for JSON parsing -# 3. No-op on every machine except original author's +# 1. Hardcoded absolute path leak (machine-specific, author-local) +# 2. Language-policy violation: used python3 for JSON parsing +# 3. No-op on every machine except the original author's # Removed from settings-snippet.json PostToolUse matcher "*" block. exit 0 diff --git a/hooks/graph-export-watcher.sh b/hooks/graph-export-watcher.sh index a2ae35a..aefc4a2 100755 --- a/hooks/graph-export-watcher.sh +++ b/hooks/graph-export-watcher.sh @@ -3,7 +3,7 @@ # Bypass: GRAPH_EXPORT_BYPASS=1 INTERVAL="${KEI_GRAPH_EXPORT_INTERVAL_S:-5}" -OUT="${KEI_GRAPH_VIZ_DIR:-$HOME/Projects/lbm-graph-viz}/data-runtime.js" +OUT="${KEI_GRAPH_VIZ_DIR:-$HOME/.local/share/kei/graph-viz}/data-runtime.js" BIN="$(command -v kei-graph-export 2>/dev/null || echo "$HOME/.cargo/bin/kei-graph-export")" [ -x "$BIN" ] || exit 0 diff --git a/hooks/no-github-push.sh b/hooks/no-github-push.sh index 725845c..95084d5 100755 --- a/hooks/no-github-push.sh +++ b/hooks/no-github-push.sh @@ -1,9 +1,10 @@ #!/bin/sh -# no-github-push.sh — PreToolUse:Bash hard deny (RULE 0.1 NO GITHUB PUSH) +# no-github-push.sh — PreToolUse:Bash hard deny. # -# Blocks any Bash command that would push code to github.com. -# KeiTech portfolio contains unfiled patent IP — a public push destroys -# priority date and trade secrets. Irrecoverable. +# Blocks any Bash command that would push code or create a repo on github.com. +# Opt-in guard for teams that keep proprietary code on a private remote +# (Forgejo / Gitea / self-hosted) and want a hard stop against an accidental +# public push. Off by default in the public kit — enable it in onboarding. # # Exit codes: # 0 = pass (command is safe) @@ -69,18 +70,16 @@ fi # --- Block ------------------------------------------------------------------ cat >&2 <<'EOF' -[no-github-push] BLOCK — RULE 0.1 NO GITHUB PUSH -KeiTech portfolio contains unfiled patent IP. Public push destroys -priority date + trade secrets. Irrecoverable. +[no-github-push] BLOCK — push to github.com is disabled by this guard. +This checkout is configured to stay on a private remote; a public push +could expose code you intend to keep private. -Use a private remote instead (Forgejo, Gitea, self-hosted): +Use your private remote instead (Forgejo, Gitea, self-hosted): git remote set-url origin ssh://git@//.git git push origin Bypass (visible, per-call): Set env KEI_NO_GITHUB_PUSH_BYPASS=1 before the command. - You must also add confirmation phrase: "yes, push patent code to github" - + "confirm publication" in the session turn. EOF exit 2 diff --git a/skills/ci-scaffold/phase-1-intake.md b/skills/ci-scaffold/phase-1-intake.md index 6cd4123..95aea93 100644 --- a/skills/ci-scaffold/phase-1-intake.md +++ b/skills/ci-scaffold/phase-1-intake.md @@ -27,7 +27,7 @@ Store the reply verbatim as `REPO`. } ``` -Store as `PLATFORM`. If `Both` is selected, emit a one-line confirm: "You understand — only non-patent code ever pushes to GitHub?" and wait for a `y` typed reply before proceeding. +Store as `PLATFORM`. If `Both` is selected, emit a one-line confirm: "You understand — only public-safe code ever pushes to GitHub?" and wait for a `y` typed reply before proceeding. ## 1c — Languages click (AskUserQuestion, multi-select)