Coding Higher Mind: the AI system behind the work

A meta layer under every project I build with AI: hardened prompts, automatic checks at every step, AI reviewers split by speciality, and a loop that turns failures into checks. Counted where it can be; estimates are marked as estimates. Open source.

PG v1.9.0, as of November 4, 2026. Sixteen public versions in 54 days. On October 14 the system was declared complete and moved to maintenance mode; 1.9.0 collects three weeks of changes made under that rule, and the section “Where improving stops” explains what that means and why.

My CV says AI coding agents write the code, while I own the specification, the review and the deploy. A claim like that needs evidence, so this page shows the system itself: what runs in the background, what it enforces, how it learns from its own failures, and where it stops. PG (Prompt-Guard) is not a project; it sits under all of them. Whatever repository an agent opens on my machine, the same rules apply: a change written by AI does not reach a product without passing automatic checks, the AI shows proof before it says “done”, and it uses passwords and keys without ever seeing them. Everything below runs today unless a section says otherwise. Two things do not: the release pipeline from version 1.7.0 has not had its first drill on a test project yet, and the scheduled routines are switched off until I fix their setup after a computer move. The whole system is a public repository you can install in five minutes.

github.com/kamiljan11/coding-higher-mind →

185past failures turned into checks
14hooks on 8 kinds of event
9specialist AI reviewers
61tools that use no AI tokens
730checks in the gate test battery
16public versions in 54 days
31 / 50repos under strict branch protection
165keys and passwords the AI never sees

Counted on November 4, 2026: hooks, tools, reviewers and scars in the public repository; tests, protection and secrets on my machine and on GitHub.

How this page is laid out

Seven parts. Pick the one you came for; every section has its own link, and a small square marks the ones with a chart. In a hurry? The last part tells the whole system in 30 seconds.

Part 1 / 7

What it is

↑

The whole machine on one map

I set the direction. Two AI tools do the work. PG sits underneath both, and every change passes its checks before it reaches any project.

KAMILspec · architecture · review · deployClaude Codecode · CI · productionGitHub · browser · mail via MCPClaude Desktop (Cowork)mail · documents · researchoutreach · design · opssame rules · same memoryVAULT165 secretskeys go to the process,never to the chatMEMORY2,600+ notesloaded at session start,sessions self-documentPG · GATESprompt · edit · command · stop · commit · push · CI · review · production proofEVERY PROJECT50 repositories: apps, websites, automationsPG is a meta layer: the same gates sit under every project, whichever it is. I set the direction; proof comes back up.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Claude Code: the terminal tool for everything that is code: apps, websites, automations and their CI. It reaches GitHub, mail, the browser and the desktop through MCP connectors. This is where the hooks and git gates apply.
  • Claude Desktop (Cowork): the tool for operations: mail, documents, research, outreach and design. It has no hooks, so the working rules travel as text inside every prompt, and the status word at the end of each report is the main protection.
  • 78 skills: versioned instruction packages that tasks are routed to, 61 in the coding tool and 58 on the desktop, 41 of them installed in both. A router matches each task by fixed rules and announces which steps it will run before the work starts.
  • The right model for the job: the main session plans and checks. Helper agents get a model sized to the task: the smallest for lookups, the middle one for writing and checklist reviews, the strongest for hard reasoning and for security, data and verification on risky changes. Capacity is a weekly budget, and the system spends it on purpose.

Mind map: what “higher mind” is made of

PG stands for Prompt-Guard: it began as a protocol injected into every prompt and grew into the whole quality system. “Higher mind” comes from my other long project, a free guidebook on practical spirituality, whose rule is practice over belief. Here that means: a rule you intend to follow is a belief; a check that runs on its own is a practice.

Prompt layerprotocol on every promptcompressed reportsskill routerEvent hooksedit → lint + typescommand guardstop gate: tier from diffGit gatessecrets · base freshnessdeps · duplicates · TODOsSQL lint · boundariesReviewer departmentscode · security · data · opsux · product · qaverifier · devil's advocateDoctrinedesign before code“done” per risk tier185 scarsRepo templateCI + mutation testingparsed boundariesQA matrix · privacy · runbookRoutinesPR reviewer · health checkvulnerability watchpaused until setup is fixedSelf-testsevery gate has a testrule → gate coveragehealth auditHIGHER MINDPG · PROMPT-GUARDEight parts, one rule: nothing important exists only as written text. Every rule has an automatic check.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

Three ideas the whole thing rests on

  1. Checks, not written rules

    Instead of a rule written as text, which an agent can forget

    Now a gate that runs by itself, with a test proving it blocks

    Why with the rule only written down, 79 % of commits still went straight to the main branch

  2. Every failure becomes a check

    Instead of a mistake, then a promise to be more careful

    Now a scar written down with its cause, then a new gate or checklist item

    Why 185 real failures are catalogued as scars, and every checklist item cites an incident or a source

  3. Proof, not claims

    Instead of “done”, because the agent says so

    Now a command ran, its result was checked, and the report ends with VERIFIED, UNVERIFIED or FAILED

    Why in one benchmark 75.8 % of the failures of self-assessing coding agents were reported as success

Each idea swaps a habit for a mechanism; the reason is a measured number, not a preference.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Checks, not written rules: the audit that started all this found that every rule written only as text was broken at scale: 6 of 7 repositories had no architecture decision records, the changelog was 105 commits behind, code review ran in 2.5 % of sessions, and 79 % of commits went straight to the main branch. An agent can forget a rule, so a written rule is not enough. Everything that matters runs by itself when something happens (that is a gate), every gate has a test proving it blocks, and a script checks that every written rule has a gate.
  • Every failure becomes a check (scar → gate): 185 real failures from my projects are catalogued, each with a rule id. I call them scars. Every checklist item cites the incident or source it came from, a habit taken from Google SRE. A postmortem ends with a new gate or a new scar, never with “be more careful”.
  • Proof, not claims: “done” means a command ran, it returned an exit code, and the state afterwards was checked. Every report ends with one word: VERIFIED, UNVERIFIED or FAILED. AI agents measurably overstate success (in one benchmark 75.8 % of their failures were reported as success) and they give in when pushed. The status word is the counterweight.
Part 2 / 7

How a change is guarded

↑

The life of one change

Nine checkpoints run by themselves at fixed moments, from the prompt to production. Nobody has to remember to check, and a red result stops the change where it is.

LIVEpromptprotocol injectededitlint + typecheckcommandguard + no-verifysession endtier + tests+ reviewerscommitmessage · secrets ·deps · SQLpushno main + size+ cyclesCImutation + secretsmergecurrent merge-refonlyproduction200 from real domain✕ no silent skipping: quality gates pass only with a log entry · risky steps only after a sub-agent review ·irreversible steps and the gates themselves only after my “pozwol ALLOW_…” in the chat · a routine pullrequest merges without my phrase only with proof of reviewNine checkpoints on the path of a change. I make the decisions; the checks make sure nothing is forgotten.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • When I send a prompt: a hook adds the working rules to the prompt. If the task is unclear, the agent asks instead of guessing. A fact needs an opened source first. Anything that blocks the work goes in the first line of the report, and “how is it going?” never gets “fine”: it gets the goal, the budget, the risks and the decisions that are mine to make.
  • After every file edit, including edits made in the terminal: the changed file is checked for style and type errors, and the errors go straight back to the agent that made the edit, in the same session.
  • At every terminal command: a guard blocks the dangerous ones: skipping the checks (--no-verify), rewriting or throwing away history (force-push, hard reset), recursive deletes outside build folders, merging from a script other than the one that demands proof of review, secrets typed into a command, and a downloaded script run straight in the shell (curl | sh). It reads a command the way the shell would, so it also sees commands hidden inside sh -c, $(…), heredocs whose text the shell will execute, or tricks like rm${IFS}-rf. Encoded PowerShell is only logged for now.
  • When a session ends: the stop gate measures the risk tier from what actually changed (paths and size, never the wording of the prompt), runs lint, types and tests in the changed repositories that have them set up, and keeps a session at tier T2 or above open until the required reviewers have checked it. The test verdict comes from the exit code: an import error or zero tests run is red, not “skipped”.
  • On every commit: a conventional message; a secret scan; base freshness (a clone on an unrelated history is blocked); duplicated text in new code; a new dependency must exist on npm or PyPI and not sit one typo away from a popular package; commented-out code; a new TODO without a ledger row; a personal-data column without a privacy inventory row; SQL migration lint (row-level security with both USING and WITH CHECK, definer hygiene, tenant keys); GitHub's own parser on workflow files; and a removed security step in CI.
  • At every push: nothing goes straight to the main branch. A change above 1,500 source lines is split, while one topic such as a migration stays together. A new circular import, or an import that breaks the layers declared in the architecture document, is blocked. If someone else committed to the same branch in the last day, you get a warning.
  • In CI and at merge: the same checks run again, plus a secret scanner (gitleaks) and mutation testing on the changed files: the tool plants small bugs on purpose, and a test that catches none of them is theatre. 31 of my 50 repositories have strict branch protection generated from the names of their CI jobs. A pull request merges only if its checks ran on the current merge result: once, green checks on an outdated base broke main.

Risk tier: measured from the change, never declared

The amount of checking is proportional, and that is enforced too. A prototype is not nagged for architecture records; a change to payments cannot close without a security review.

  1. T0docs, copy, styles, assetsscript checks onlyreview cost0 AI tokens
  2. T1one isolated component or helpercode review recommendedreview cost≈ 1 review
  3. T2shared logic, API, dependencies, CI, > 150 linescode + operations (+ UX, + data)review cost≈ 4 reviews
  4. T3login, permissions, payments, secrets, migrations, cron, > 600 linescode + security + data + operations → verifierreview cost≈ 8–10 reviews
The tier comes from the paths and size of the change, never from the prompt. At T3 the strongest model reviews security, and data too when the change touches the schema or migrations.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • For each repository: a minimum tier, a lifecycle stage (prototype, proof of concept, MVP, production) and an optional QA address. Moving to production requires a written production-readiness review in the same commit. With a QA address set, the QA reviewer becomes mandatory for T3 changes that touch the interface.
  • Committing early changes nothing: a commit made before the session ends still counts toward its tier, and a review the aggregation script marks as incomplete does not close the session.

Exceptions: who may wave a gate through

A gate that can never be passed gets worked around, so every gate has a way through. What decides who may use it is whether the step can be undone, not whether I happen to be at the computer.

A · the agent

who decides
the agent fixes the problem or moves on knowingly; every pass is logged with the gate's name
how long
one pass, logged
for example
change size, a TODO without an entry, commented-out code, repeated text, module boundaries, commit format

B · after a review

who decides
the agent, but only after sub-agents reviewed the exact code and it fixed their findings
how long
15 minutes, one command, one repository
for example
deleting files, a hard reset, cleaning the repository, an unknown dependency, a personal-data column

C · only me

who decides
me, by typing the phrase in the chat
how long
30 minutes, 3 uses (60 minutes and up to 200 uses for work on PG itself)
for example
changes to the gates, push to main, secrets in a commit, weaker CI, force-push, deleting a repository
Level C covers whatever cannot be undone or would switch off other checks. If the agent could approve changes to its own gates, A and B would mean nothing.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Proof, not a claim: the first review of this mechanism faked the proof of review with two empty files. Now only the transcripts of real reviewer sub-agents count, every finding they recorded must stay in the result, and one review never grants a second exception, even if its folder is copied. A command that tries to leave the repository (changing directory, a variable, a shell wrapper) does not get the exception.
  • My phrase means only my phrase: an exception at level C exists only after I type “pozwol ALLOW_…” (Polish for “allow”) in the chat. The same words echoed in an agent's reply or in a sub-agent's report unlock nothing, and every use goes into the log.
  • The clock slip: once the system clock jumped to 2022 for a moment. My exception file got a date four years in the past and the cleanup deleted it as stale, although it had half an hour left. Validity is now read from the file's content, not from when it was written.
  • Kill switch: one switch brings back the strict mode where every exception needs my phrase, and the switch is protected the same way as the gates.

Merging a pull request: without my phrase, but only with proof

Typing a phrase for every routine pull request had become the bottleneck. Now the merge script decides from the risk of the change and the proof attached to it.

pull requestall checks green on the current merge result
  • documentation onlyno review neededmerges on its own
  • an ordinary code change (T1)a code review of exactly this diffmerges on its own
  • shared logic (T2)code and operations reviewsmerges on its own
  • T3, logins, payments, migrations, dependencies, CI, agent instructionsmy “pozwol ALLOW_MERGE”waits for my phrase
On since October 4. The review must name the diff by its checksum and is valid for two hours.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • What counts as proof: a review that names this exact diff by its checksum, with the verdict recomputed from the findings and the reviewers' own transcripts rather than from a summary, valid for two hours. Anything touching logins, payments, migrations, dependencies, CI or the agents' own instructions still waits for me.
  • A second proof the agent cannot reach: a review kept on the agent's own machine could in principle be forged by that agent, so a pull request can also be reviewed in CI: a clean runner, read-only tools, the configuration taken from the base branch. The merge script reads that run through the GitHub API and keeps 90 days of verdicts, so rewording a change to roll the dice again does not work on the same branch. It is set up in three repositories.
  • Sessions do not mix: when two sessions work in one repository, a commit counts for a session unless there is positive proof it came from the other one; when in doubt, it counts.
  • Honest limits: the CI review is one model, so it is a probabilistic proof that a crafted diff can try to talk around. That is why the check is not a required status in branch protection (GitHub counts a skipped job as passed), and why one file turns phrase-only merging back on. The planned week of watching the CI reviewer has no written result yet.

Review like a software house, not like a chat

Each AI reviewer covers one speciality and starts with a clean slate. A script, not a model, combines their findings: an issue blocks only if enough reviewers report it independently or the verifier reproduces it, and an issue without proof is dropped. The verifier's job is to disprove.

ORCHESTRATORSCRIPTSlint · types · tests · SQLcodesecuritydata · opsux · product · qaAGGREGATEk-of-n · needsproofVERIFIERreproduce or refuteFIX + RE-GATE✕ no chat between agents · a finding without an executed command does not countReviewers get only code that passed the scripts. A script merges findings. The verifier hunts for bugs, not confirmations.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Nine specialist reviewers: code, security, data, operations, UX, product, QA, a verifier and a devil's advocate. Each works from a short checklist of numbered rules, and every rule has a command to run, a severity policy, a fixed output format and a worked example of a false alarm it must reject. Reviewers only read; the main session makes the fixes.
  • Each reviewer reads its own slice: one audit found that reviewers given a 9,799-line diff read about 10 to 30 % of it, and a broken CSS block went past three of them. Now a script cuts the diff by department, and a second script runs 27 mechanical search rules and hands the hits to the reviewer to judge.
  • Why a clean slate: whoever wrote the code, a person or a model, does not see its own mistakes. Reviewers get only the change and the task and never see each other's findings, because agents that discuss drift toward the majority even when the minority was right.
  • Decisions with a devil's advocate: architecture decisions go through fixed steps: facts, positions, a mandatory dissenter, aggregation in code, and a written decision record. Injected dissent is the one intervention shown to cut failures caused by quiet agreement in groups of agents.
  • Calibrated monthly: the same bug is packaged twice, once bare and once with a persuasive description, and fresh reviewers check both in random order. If their verdicts differ, length or wording is biasing them, and a person adjusts the checklist.

Every failure becomes a check: how the system learns

A failure is not closed when it is fixed. It is closed when it cannot happen again without a script noticing.

incident orrepeated correctionroot cause:five whysscar +rule idgate + testthat it blocksa script counts ruleswithout a gatehealthauditThe loop feeds itself: the health audit (a weekly timer, switched on November 15) finds checks that stopped working, and each becomes a new scar.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • An outdated base broke main: two pull requests each passed, but each against its own older copy of the main branch; merged together they broke a workflow file. Now merges require checks on the current merge result, strict branch protection is generated per repository, and a scar records the mechanism.
  • A check that never ran: the push gate read its input twice and did nothing for six days. Now every git hook has a test that runs the whole script with real input, and a weekly audit checks that every gate still blocks.
  • 45 copies of a company identity: spread over 11 files, and every one passed lint, types, tests and review. Now a duplicate check runs on added lines (since 1.8.0: the same text six times in at least three files).
  • An invoice that changed the seller: a default value quietly swapped the seller after a profile was deleted. A silent fallback on any field with consequences is now a blocker in the code checklist: with no match, the code must stop with a named error.

Guarding the guards

A quality system an agent can quietly switch off is decoration. So the rules protect themselves first.

The operating system's sandbox: the line against an agent determined to get around the guard. PG does not claim to hold it.

What stops them being switched off

THE RULEShooks, git gates, settings and gate tools
Seal: checksums on the control layer; a change outside a window I opened shows up at the next session and in the health audit
Extensions: installing, enabling or updating a mod needs my phrase; turning one off is always allowed
Database target: destructive SQL is blocked unless the target is provably on my machine
Patches: patching or unpacking an archive is blocked in PG's folder and every folder above it
Built against mistakes and instructions smuggled in from outside, not against a determined agent.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • A seal on the control layer: hooks, git gates, settings and gate tools are sealed with checksums. A change outside a window I opened shows up at the start of the next session and in the weekly audit.
  • Extensions under the same guard: Claude Code mods run inside the tool and skip the hooks, so installing, enabling or updating one needs my phrase. Turning one off is always allowed.
  • No dropping a production table by accident: every command that talks to a database is traced to where it points, including connection strings, environment variables set in the same line and wrappers such as docker exec or ssh. Destructive SQL is blocked unless the target is provably on my machine, and SQL the guard cannot see counts as destructive.
  • No rewriting the rules through a patch: patching, unpacking an archive or running a scripted editor is blocked in PG's folder and every folder above it. In any repository a patch that touches .git/config or .claude/ is blocked, with a pointer to git apply, which refuses those paths.
  • Honest limit: the guard is built against mistakes and against instructions smuggled in from outside, for example from a web page an agent reads. It does not stop an agent determined to get around it, because running any script can do anything. That case belongs to the operating system's sandbox and permissions, and it is written down in the known-limits file.
Part 3 / 7

Architecture and releases

↑

How architecture gets decided, and how it stays decided

Most projects decide their architecture once, in a document nobody opens again. Here every decision is a row with evidence, and a script checks the code against those rows whenever a session starts and before it may finish.

Rows in every design matrix 62

  • system-design areas 37
  • tool layers of the stack 25

Named options in the course, before 1.5.0 437

  • PG knew when to choose it 46 %
  • name only 26 %
  • missing 28 %

Areas the design process forced a decision in, before 1.5.0 37

  • yes 15
  • partly 11
  • no 11

First real run: a client app, October 6 37 rows

  • decision 31
  • not applicable 5
  • not now, with a signal 1
The audit measured the gap; the matrix closes it by making every area a row that a script checks.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • One row per area: 62 rows: 37 system-design areas (data, scaling, queues, caching, login, rate limits, releases and more) and 25 tool layers from the frontend to payments, invoicing and parcel shipping. Each row is a decision with evidence, not applicable with a reason, or not now with a measurable signal to come back, such as “more than 50 requests per second”.
  • A council instead of one architect: twelve agents work in parallel, one per group of areas. Groups whose decisions are hard to undo (data shape, identifiers, files, identity, region, disaster recovery) get the strongest model and must be decided even in small projects.
  • Why the matrix exists: the October 6 audit counted 437 named options in a system-design course: PG could choose between 46 % of them, knew another 26 % only by name and missed 28 %. Nothing made the architect walk through every area. On a client app the same day the council filled all 37 rows and listed about 60 gaps with evidence; at least one was a false alarm, so a person still reviews them.
  • Kept honest by the code: a script that uses no AI compares the project with its decisions at the start of each session and prints one to three lines only when something is off: an undecided area, technology the decisions do not mention, or evidence pointing at a file that no longer exists. In new projects a session cannot finish with drift left behind; in old ones it is a hint.
  • Scaling only when the numbers say so: the not-now rows keep their thresholds, and a seven-step ladder goes from one server through queues and caching to read replicas, so the decision to scale comes from data, not fear.

A release pipeline with AI in the loop, for a one-person company

Big companies have a release team, people on call and a second engineer on every change. I do not, so the pipeline does that work, and AI does the parts that need judgment.

  1. 1build and teststhe checks every pull request already passes
  2. 2probe the previewautomated requests on the paths that must never break
  3. 3wait 10 minutesthe new build tested outside live traffic before the domain switches
  4. 4watch 15 minutesthe live site checked every 30 seconds

↺ three failed checks in a row (about a minute) bring back the last good version, once; after that, a person decides

Designed and reviewed; not yet rehearsed on a live project.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Knowing when not to go back: a database outage, a firewall blocking the test machine or a redirect are not faults of the new version, so they raise an alarm instead. If the release changed the database structure or server functions, going back would run old code on the new structure, so the pipeline stops and asks me. After one automatic return, nothing goes back on its own until a person closes the incident.
  • AI on duty, with no keys to the building: when a gate turns red, a fresh Claude instance on my subscription reads the test results and the release's changes and writes a diagnosis into the incident. It can only read; a separate trusted step posts its comment.
  • Machines check what machines can: build, types, tests, licences, leaked-secret scans and probe requests are plain scripts with no AI tokens. AI reviewers take the parts that need judgment, and I take what cannot be undone: risky merges, money, and keys.

Six review rounds before the pipeline shipped

Version 1.7.0 went through six full rounds of AI review and two smaller checks of the final fixes. Blocking findings must be fixed before release; major ones are fixed in the same round.

blocking major
round 1: 1 blocking, 11 major1 + 11round 1round 2: 1 blocking, 13 major1 + 13round 2round 3: 0 blocking, 11 major11round 3round 4: 0 blocking, 8 major8round 4round 5: 0 blocking, 9 major9round 5round 6: 0 blocking, 8 major8round 6final checks: 1 blocking, 2 major1 + 2final checks
Release 1.7.0: findings per review round. Rounds 1 to 6 used three or four reviewers; the two final checks of the fixes used two.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • What the blocking findings were: two security holes I had not seen. The test script and its list of allowed addresses were read from the change that triggered the run, so an attacker could supply their own; and the AI on duty could read a token from the repository's settings file and paste it into an incident comment. The final checks found a safety rule without a test. All were fixed before release.
  • Honest limit: the pipeline has not run on a live project yet. The plan is a drill on a test copy in both directions: a green build must reach the domain and a red one must not.
Part 4 / 7

Proportion, and where improving stops

↑

The same rules for a smaller context bill

Every message to a model carries background text it reads first, and that text is paid for in tokens. I measured PG's share and cut it without dropping a rule.

before after

Rules added to a follow-up prompt about code

before 4.9 KBafter 0.9 KB

Memory loaded at session start

before 35 KBafter 25 KB

Weekly limit used per request: 1M window (before) vs 400k (after)

before ≈ 2.3×after 1×
Versions 1.4.0 and 1.8.0. Kilobytes measured on the injected text; the window ratio is estimated from my transcripts.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • The full rules once per session: the prompt hook sends the full protocol once, then a one-line reminder. After compaction or in a new session it sends everything again, and whenever it is unsure what was sent, it sends everything.
  • Memory that is current and still complete: the newest checkpoints come first, unfinished work from other sessions is listed by title, and every shortened file keeps a list of its remaining sections. A budget check turns red if the start-up text grows back.
  • A context window chosen on purpose: Claude can hold a million tokens, but every message resends all of it. In my transcripts a 1M window used about 2.3 times more of the weekly limit than 400k, so the window stays at 400k. A 600k trial has a rule fixed in advance: it stays if the week ends under 90 % of the limit and nothing gets blocked. I have not recorded the result of that trial yet.

Proportionality: fewer blocks for the same safety

Version 1.8.0. For weeks, every risk I noticed got a new gate. Then the gate log showed the cost: some gates stopped my normal work far more often than they caught a mistake. So one rule now sits above the others: no incident, no new block.

gatebefore 1.8.0since 1.8.0
change size400 source lines1,500; one topic stays together
duplicated text3 times in 2 files6 times in 3 files; seed data ignored
deleting a build cacheblockedallowed; .. and links still blocked
lint after an editevery fileskips throwaway scripts outside a project
changeloga line in every pull requestcollected from titles at release
routines' scopeevery repositoryactive ones: 13 of 50
Thresholds recalibrated from the gate log, with test runs filtered out. Each change says how to roll it back.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • New checks start by watching: a new gate only observes and logs what it would have blocked. It may block only after a real incident, and changes to PG reach new repositories through the template, while old project repositories are read-only for agents unless I ask.
  • Routines look only at live work: a script reads GitHub history and keeps repositories with real work in the last 30 days, ignoring days when PG swept the whole fleet, the same change rolled out everywhere, and dependency bots. On November 4 that was 13 of 50.
  • Cleaner numbers: test runs used to write into the same log as real work and inflated the counts I calibrate with. Tests now write to their own log, and the weekly health check counts their traces separately.
  • Reviewed before release: several rounds of independent reviewers. Among other things they caught that one GitHub hiccup could silently cost a month of vulnerability checks, and that an empty answer from GitHub would look like a quiet month; both now end as a visible failure.

Where improving stops

On October 14 I decided that PG is complete for now. Not because nothing could be added, but because adding more had started to cost more than it protected.

PG still changes when

  1. an incident slips through: a real failure that a gate should have caught.
  2. a tool or model changes: an update breaks a hook or changes how the agent behaves.
  3. I ask: a deliberate decision, not a routine finding work for itself.

No rule can reach

  1. a determined attacker: writing a script to a file and running it beats any text rule; that is the operating system's job.
  2. the meaning of code: a pattern check cannot tell good logic from bad; that is what review and tests are for.
  3. a target that becomes the goal: once the count of gates or green runs is the aim, it stops measuring quality.

Stop signal: two rounds in a row that find only edge cases never seen in real work. The parser rewrite hit it after nine.

Decided on October 14, 2026. The quality of the work should come from the checks that exist, not from their number.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • The signal that showed it: a rewrite of the command guard's shell parser went through nine rounds of AI review. Every round found new edge cases, and none of them had ever happened in real work. That is an asymptote: effort grows, protection does not. The parser was closed, and the guard that runs today stays as it is.
  • What the guard is for: agent mistakes and instructions smuggled in from outside. Not a deliberate attacker: that fight cannot be won with text rules, since writing a script to a file and running it bypasses any parser. Naming the threat model ended the parser debate in one sentence.
  • What maintenance mode means: PG changes only after an incident that slipped through, when a tool or model update breaks a hook, or when I ask. On November 15 I switched the health-check script back on as a weekly system timer that calls no model, while its old routine stays off with the others; no new mechanism is added for its own sake. The quality of the work should come from the checks that exist, not from the number of checks.
Part 5 / 7

Trust and operations

↑

VERIFIED · UNVERIFIED · FAILED: the word that stops the AI telling you what you want to hear

Every substantive report ends with one of three words. It is the smallest part of the system and the easiest to take elsewhere, especially to Claude Desktop, where the prompt is the only protection.

  • VERIFIED: the claim comes with its proof, quoted rather than described: the command and its exit code, the HTTP status, the line of test output, the diff, the path to a screenshot.
  • UNVERIFIED: the work is done but the proof is missing. The report says what is missing, how to check it and what would change the conclusion. A report with no status word counts as UNVERIFIED.
  • FAILED / BLOCKED: what happened, word for word, without softening. Anything blocking the work (missing access, a decision, data, a secret or a broken tool) goes in the first line, never at the end.
  • Why it exists: when a user pushes back with a wrong claim, models in published studies give in about 58 % of the time, and in one benchmark agents predicted 61–77 % success while achieving 22–35 %. The status word forces every claim to show evidence or admit it has none, and “are you sure?” makes the model re-check the evidence instead of politely changing its answer.
  • In Claude Desktop and scheduled tasks: every background prompt gets a seven-line verification block: do not assume the prompt is true; you may refuse and report failure; restate claims as neutral questions; no success without evidence; attack your own result before reporting; re-check when challenged; end with the status word. The block is in the repository, ready to paste.

Passwords and keys the AI never sees

VAULT165 secrets · self-hostedBRIDGEpasses to the processTARGET PROCESSdeploy · API call · CIchat ✕code ✕logs ✕The agent can use a password or key it can never read.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • A vault on my own hardware: 165 API keys, tokens and logins live in a self-hosted vault. A bridge passes a value straight into the process that needs it, as an environment variable, so it never appears in the chat, the code or the logs. The command guard blocks a secret typed into a command, and the scans at commit time and in CI keep it that way.

Routines: the part that runs while nobody is typing

Script first, model only when the script finds something. Anything that could find itself work is off by design.

Status on November 15: PG routines switched off until their setup is fixed; the health check runs as a system timer instead.

  • Pull request reviewweekdays · returns
  • Health checkweekly · timer since Nov 15
  • Vulnerability watchmonthly · returns
  • Reviewer calibrationmonthly · stays off
  • Look at similar projectsmonthly · stays off
  • Model line-up checkmonthly · stays off
  • Repository clean-upmanual only
Dots show the planned cadence. The three that stay off only work on PG itself, which is in maintenance mode.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Why they are off: after the move to a new computer on October 3, most routines started in a folder the app no longer trusts, and the rest stopped at a permission prompt nobody was there to answer. None did real work, so all are switched off until the setup is fixed. Three come back: the pull request review, the weekly health check and the vulnerability watch. Three that only work on PG itself stay off.
  • Pull request review (weekdays): reviews open pull requests in the active repositories the way a senior engineer would. Mechanical fixes land as separate commits with proof; design and security findings stay as comments for me.
  • Health check (weekly system timer, switched on November 15): script checks that the quality system is still wired in: hooks registered, gates still blocking, which escape hatches were used, and which routine started but never finished. A failed or interrupted run of any routine is red.
  • Vulnerability watch (monthly): a script reads GitHub's own vulnerability alerts (on in 44 of 50 repositories) and audits the lockfile. It tells “no scan” from “no findings”, so an empty or failed read never counts as a quiet month. Fixes are patch or minor updates, always as pull requests with evidence.

50 repositories, and the 13 that are alive

Most of my projects are finished. PG still guards all of them, but the routines spend their time only where work is happening.

  • active in the last 30 days 13
  • finished or resting 36
  • never checked by routines 1
33 with branch protection, 31 of them strict44 with GitHub vulnerability alerts on
One square per repository, counted from GitHub on November 4, 2026.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

Memory, measurement and the retrospective that rebuilt the system

  • Persistent memory: a local base of more than 2,600 notes; the relevant part loads at the start of every session, and each session writes a note when it ends, so the next one starts from a checkpoint instead of from scratch. One honest gap: sessions started in a temporary workspace do not always leave a transcript for that note, and the health check flags it.
  • Telemetry, not feelings: every skipped check is logged with a reason, and scripts mine agent transcripts and git history: corrections per session, repeated tool errors, fixes within a day of the previous commit to the same file, and the files that change most. The numbers decide what becomes a gate.
  • The retrospective that mattered: twelve repair loops in one session were traced to their causes, and three had the same defect: the system claimed a check it did not physically have. The answer was structural: every gate got a test proving it blocks, and checking that every rule has a gate became a script.
  • The same method, applied to me: my code-reading practice is built like the rest of the system, daily, verified and public: github.com/kamiljan11/code-reading-quest.

Does it hold at scale?

  • The honest answer: one function is easy. A 200,000-line system with unwritten assumptions about its architecture is where consistency drifts. So the assumptions are written where a script can read them: the architecture document in repositories built from the template has a machine-readable block of layers and forbidden imports, and the push gate blocks a new import cycle or a broken layer. Old cycles only warn, and historical debt is never cleaned up automatically.
  • Checking the impact before an edit: a file that more than 40 others import is flagged, and the design step asks who calls this, what else reads this data, and which risk tier the change falls into.
  • Readable by a person: the tool index is generated from each tool's own header, and a tool without a description shows up as debt. Every style decision answers one question: can a senior engineer who has never seen the repository run it in 15 minutes, find the place to change in 15 more, and understand why?

Several sessions at once, one coordinator

On November 14 I ran five projects in parallel, each in its own Claude Code session. One more session watched the whole thing and wrote no code itself. It is a protocol and templates from one day of work (v0), not a platform.

  • Who does what: there is exactly one coordinator. It keeps the task ledger and collects the decisions only I can make. Every project has its own session and its own working copy of the repository, and every file has one writer. The coordinator does not edit project files, does not merge and does not spend money.
  • What it does each cycle: it checks that the sessions are alive and that none sits idle with open work when it is not waiting for me. It checks every claim in a report at the source: the state of the pull request, the git history, the file on disk. Every task ever reported must be in one state: done with evidence, in progress with an owner, waiting for me, parked, or dropped with a reason. A row without an owner is a lost task.
  • The session report: four lines: done with evidence, in progress, next, parked or dropped with a reason. The last one is mandatory, because that is where quietly dropped tasks show up.
  • When to stop: a session with an empty queue runs one fresh-eyes pass. With the full loop, two passes in a row with no serious finding mean further passes add little, and work on that project stops. Not every project gets the same loop or the same threshold: I set them per project before the work starts.
  • What the first day taught: 19 lessons, each from a failure I saw. A few of them: three sessions acted as the coordinator at once. A pull request list given from memory was out of date. A session stopped at 82 % of its context window and nothing restarted it. A lenient verifier hid a failing source: 10 % with it, 36 % with a stricter one. The computer went to sleep because the sleep lock was held by a session I had archived.
  • What it is not: nothing here is automated: the ledger is a table in a file edited by hand, and I start the coordinator myself. There is no interface, daemon or database, and for now none is planned. It counts as switched on after one day in which no row is left without an owner at any check and no claim reaches me unchecked. I have not measured such a day yet. The repository with the protocol is private.

Fixes from use, not from news

For two months I kept adding rules from courses, other people's repositories and my own failures. On 15 November I turned that around: once a week a script works out from the system's own logs which rules are worth changing. It never calls a model, so such a week costs zero tokens.

  • Three questions to the logs: which rule has not fired once in six weeks of work, which gate I bypass more often than I obey, and which mistake reviewers keep getting fixed across different repositories. The first is a candidate to remove, the second to relax or repair, the third to turn into an automatic check.
  • The first report on real data: eight candidates, of which the report shows at most five a week. I bypassed the change-size gate after a block 14 times out of 14. Within 28 days reviewers got a missing failure-path test fixed 36 times in 14 repositories, a silent fallback 22 times in 9, an unrecorded architecture decision 21 times in 9 and data hardcoded in code 12 times in 8.
  • The decision stays with me: the report blocks nothing, removes nothing and changes nothing. Next to a candidate I write “accepted” or “rejected”, and a candidate without a decision comes back the next week. An accepted change then takes the usual route: a branch, a review, my approval.
  • New rules only where there was a failure and a gap: the same day I compared the 188 failures recorded by then (185 on November 4) with what the gates actually see, and added detectors where a failure had happened and nothing caught it. Each one starts in observe mode: it records what it would have blocked and blocks nothing. I ran them against history. The rule for commands that delete Docker volumes: 0 hits in about 5,300 commands. Bulk permission grants in migrations: 2 files out of 2,964. I threw one detector out after review, because today it had nothing to detect.
  • What is not there yet: the loop and the detectors were merged on November 15 and the weekly run is switched on. The report cannot point at dead rules yet, because it needs six weeks of weekly snapshots and has only the first. Whether the system really improves just from being used will show after a few weeks of decisions. Today I do not know.
Part 6 / 7

History and use

↑

Sixteen versions in 54 days

Each release answered something real: an audit, a comparison with other projects, a failure, or friction in my own work. The details of every version are in the public changelog.

  1. Sep 121.0.0first public export of Prompt-Guard
  2. Sep 131.1.0full English protocol, bilingual block messages
  3. Sep 271.2.0rebuilt after comparing 35 open-source projects
  4. Sep 281.2.1–1.2.6six fixes: test verdicts only from exit codes
  5. Oct 51.3.0pull requests merge with proof of review
  6. Oct 51.4.0the same rules for a smaller context bill
  7. Oct 61.5.0a row for every system-design area
  8. Oct 101.6.0extensions under guard, every layer of the stack
  9. Oct 111.7.0architecture that stays decided, release pipeline
  10. Oct 141.8.0proportionality, then maintenance mode
  11. Nov 41.9.0measurement in maintenance mode
The strip has one cell per day; a filled cell is a release, and a number means several that day.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • Compared with 35 open-source projects (September 26): agents went through 35 public repositories with a similar idea and the comparison produced a plan of 23 items, each with a file and line. The design of the changes was reviewed for security before any code, and every new guard rule was replayed against real commands from my transcripts before it could block anything.
  • Six patches in one day (September 28): the stop gate trusted test output instead of exit codes, so a broken test setup could pass as “skipped”. Since version 1.2.2 a verdict comes only from the exit code.
  • Three weeks in maintenance mode (November 4): 1.9.0 collects what changed under the maintenance rule: the gates measure themselves, larger changes get a plan before code, more languages are checked after every edit, and what the agent sends after reading outside content is logged. Most of it runs in observe mode: it counts, it does not block.

Install it yourself

The whole system is a public repository, cleaned of private data. You need Node 20+, git and Claude Code.

  1. 1copy the repositorygit clone; needs Node 20+, git and Claude Code
  2. 2dry runshows the plan and touches nothing
  3. 3installcopies into ~/.claude and without --force does not overwrite a file you changed
  4. 4self-test, by itselfthe installer ends with it; the green output is the proof, not its word

↺ an uninstaller comes in the same repository

The public 1.9.0: 464 files, cleaned of private data.

Point at or tap any part of the diagram, or pick it below, to see what it does in plain words.

  • git clone https://github.com/kamiljan11/coding-higher-mind.git
  • node install.mjs --dry-run # shows the plan, touches nothing
  • node install.mjs --yes # copies into ~/.claude, merges hooks, appends the CLAUDE.md block, wires git hooks
  • What the installer promises: without --force it does not overwrite a file you changed (the other version lands next to yours; with --force it makes a backup first), merges your settings instead of replacing them, and adds its rules between markers so an update replaces only that block. Git hooks are optional. It ends with a self-test, and the green output is the proof, not the installer's word.
  • What the public 1.9.0 contains: 14 hooks, 3 git gates, 61 zero-token tools with 46 test suites, 9 reviewer departments, the doctrine with 185 scars, a repository template with CI and parsed boundary blocks, routine definitions for both tools, 19 skills, an uninstaller, and docs with the diagrams from this page: 464 files.
  • Language: the working rules have a full English version (PG_LANG=en, set from your system language), and every block message has an English line with its escape hatch. The doctrine and reviewer checklists are still in Polish (the model reads them fine); the README is in both.

Open the repository →

Honest limits

I use foundation models through their providers; I do not train them. Reliability is proven at the scale of one owner and dozens of repositories, not a large company. Reviewer departments cost tokens (roughly four times one review at T2 and eight to ten at T3), which is why the free script checks run first. Merging without my phrase rests on one model's review, a probabilistic proof. Some gates depend on a repository having what they check and skip with a logged reason when it does not.

Two parts are designed but not yet exercised: the release pipeline has had no drill on a live project, and the routines are off until their setup is fixed. The guard stops mistakes, not a determined attacker. The point of this page is not that nothing can go wrong. It is that the ways AI work goes wrong are engineered against in the open, and that I know where adding more rules stops paying.

Part 7 / 7

In short, and questions

↑

In 30 seconds

I build software with AI coding agents, and anyone who does knows the catch: the AI can be wrong and still say it is done. So I built Higher Mind, a quality system that sits under every project. Checks run by themselves at every step, from the prompt to production. On risky changes, separate AI reviewers each check one speciality with a clean slate. Anything that cannot be undone, like payments, logins or keys, waits for me. Every check comes from a real failure in my own projects: 185 so far. It is open source, and it says plainly where it stops.

The rules in a minute

The rules the article above unpacks, plus planning first and a few details taken from PG’s own files. The bold lines alone tell the whole system in about a minute; the sentences under them say what each rule means in practice, for when someone asks.

  • People own it, agents write it. AI agents write the code, while a person owns the goal, the review and the release. The system does not replace that person; it makes sure good intentions are never the only safeguard.
  • A rule is a mechanism, not text. Every rule that once lived only as prose, and was broken because of it, is now a hook: a small program that runs on its own at every edit, command, commit and push, so nobody can forget it. Cowork has no hooks, so there the rules still travel as text in every prompt.
  • Risk comes from the diff. The risk tier follows from what actually changed, not from what the author claims: docs, copy and styles are T0, one isolated component T1, shared logic, APIs, dependencies, CI or more than 150 lines T2, and login, permissions, payments, secrets, migrations, scheduled jobs or more than 600 lines T3. The tier decides how many checks the change has to pass.
  • Independent reviewers. The higher the tier, the more reviewers: code alone on an ordinary change, operations added on shared code, security and data on the riskiest; interface joins when the change touches the screen, product on shared and risky code, and QA on request. Each reads the change in parallel, each from a clean slate, without knowing what the others wrote. Reviewers only read; the main session makes the fixes.
  • No evidence, no finding. A reviewer’s finding without a concrete place in the code and a command anyone can re-run is rejected automatically. Every blocking finding, and a serious one raised by only one reviewer, goes to a separate verifier who tries to refute it, and until it rules, the review cannot end in approval.
  • Plan first, code second. A larger change starts with a design file before the first line of code: the problem, goals with a way to check each one, what we are deliberately not doing, a plan for every file, risks, and the assumptions the change invalidates. A review tool then checks that every file and function the plan names actually exists. It reports rather than blocks, so a plan written from memory instead of from the code gets caught when the plan is reviewed.
  • “Done” has to be proven. Done means only what can be shown: a test exit code, an inspected result or a server response. Every report ends with VERIFIED, UNVERIFIED or FAILED, never with a bare “it works”.
  • A person grants the big exceptions. Exceptions to the blocks exist, but the agent cannot grant itself the important ones. It may step past minor quality gates on its own, with a log entry, some only after its own review, while changes to the system itself, secrets and merging risky changes need a phrase typed by a person, valid for a limited time and number of uses.
  • No incident, no block. Every block has a scar: the real incident it was created from. A new rule starts by only watching and logging what it would have blocked, and it may start blocking only after a real incident, which then becomes its scar.
  • The system measures itself. Every skipped check is logged with a reason, every block that ended in a bypass is counted, and every reviewer finding is recorded as fixed, dropped with a reason or kept as a note, so a reviewer that mostly raises noise shows up. Scripts also count corrections and fixes made soon after a commit. The numbers decide what becomes a gate, not anyone’s impression.
  • The guards are guarded too. The system itself is protected like production code: its hooks, gates and settings carry a seal of checksums, a change to them needs a phrase typed by a person and then goes through the same review and tests as any code, and a change made outside such a window shows up at the start of the next session and in the weekly audit.

In 3 minutes

The problem first. AI coding agents are fast, but they overstate success: in one benchmark 75.8 % of their failures were reported as success. When I audited my own projects, every rule I had written down was broken at scale: 6 of 7 repositories had no architecture decision records, the changelog was 105 commits behind, and 79 % of commits went straight to the main branch.

So I stopped writing rules and turned them into mechanisms. Three ideas carry the whole thing. Checks, not written rules: whatever matters runs by itself when something happens; I call such a check a gate. Every failure becomes a check: 185 real failures are catalogued as scars, my name for a failure written down with its cause, and every gate points to the one it came from. Proof, not claims: “done” means a command ran and its result was checked, and every report ends with VERIFIED, UNVERIFIED or FAILED.

In practice every change gets a risk tier measured from what actually changed, never from how the request was worded. Documentation is low; payments and logins are high; the higher the tier, the more checking. On a risky change several AI reviewers read it independently, each from its own angle: code, security, data, operations. A script, not a model, combines what they found, and a separate verifier tries to disprove it. A change joins the main code without me only with proof of review, and logins, payments, changes to the database structure and dependencies still wait for my phrase.

And honestly: it is proven at the scale of one owner and dozens of repositories, not a large company. Reviewers cost tokens, eight to ten times one review on the riskiest changes, so the free script checks run first. The release pipeline has not had its drill on a live project yet, and the scheduled routines are switched off until I fix their setup.

In 15 minutes: six steps to talk through

The outline of a 15-minute talk, a few sentences per step to expand on, in the order I tell it: where it came from, what it is, one change from start to finish, what it taught me, where it stops, and where it is going.

  • Where it came from. AI coding agents write the code in my projects, while I own the specification, the review and the deploy. An audit of my own repositories showed that rules written as text do not survive real work: 6 of 7 repositories had no architecture decision records, code review ran in 2.5 % of sessions, and 79 % of commits went straight to main. An agent can forget a rule, so a written rule is not enough.
  • What it is. PG, short for Prompt-Guard, began as rules added to every prompt and grew into the whole quality system. The name Higher Mind comes from my other project, a guidebook on practical spirituality: a rule you intend to follow is a belief, a check that runs on its own is a practice. It has 14 hooks, small programs that fire at fixed moments, git gates at commit and push, 9 specialist AI reviewers, 61 tools that use no AI tokens and a catalogue of 185 scars. It is a public repository you can install in five minutes.
  • One change, start to finish. Say I ask for discount codes in a shop. After every file edit the agent gets its style and type errors back at once. Every terminal command passes a guard that blocks the dangerous ones, such as rewriting history or deleting outside build folders. Every commit and push pass their own gates. When the session ends, the last check measures the risk tier: discount codes touch payments, so the tier is the highest, T3, and the session cannot close until the reviewers for code, security, data and operations have checked it. A finding without proof is dropped, a script combines the rest, and the verifier tries to disprove them. A change like that merges only after I type my phrase.
  • What it taught me. Whoever wrote the code, a person or a model, does not see its own mistakes, so the reviewers start with a clean slate. A check without its own test can be dead: my push gate read its input twice and did nothing for six days, so every git hook now has a test that runs the whole script. And a block that stops normal work far more often than it catches a mistake does harm. That is why version 1.8.0 put one rule above the others: no incident, no new block. A new check only watches and logs at first.
  • Where it stops. The guard is built against mistakes and against instructions smuggled in from outside, not against an agent determined to get around it; that belongs to the operating system's sandbox. Merging without my phrase rests on one model's review, a probabilistic proof. On October 14 I decided PG is complete for now: a rewrite of the guard's parser went through nine review rounds that kept finding cases that never happened in real work. Effort was growing, protection was not.
  • Where it is going. Proportion. The routines look only at repositories with real work in the last 30 days: 13 of 50 on November 4. Changes to PG reach new repositories through the template, and old project repositories stay untouched unless I ask. PG itself now changes only after an incident that slipped through, when a tool or model update breaks a hook, or when I ask.

Questions clients ask

Why should I care how the code is checked?

Because more and more code is written by AI, and AI can be wrong while saying it is done. With this system a change reaches your product only after automatic checks, on risky changes only after independent reviewers, and anything that cannot be undone waits for a person. You can also see what was checked: every report ends with a status word and its proof.

Does this mean my app will have no bugs?

No, and nobody should promise that. PG lowers the risk and catches the kinds of failure that have already happened once. Reviews can be wrong too, and merging without my phrase rests on a probabilistic proof. The limits are written down in the open, in the last section of the part above.

What if the AI deletes my database?

Every command that talks to a database is traced to where it points. A command that would delete or wipe data is blocked unless the database is provably on my machine, and a command the guard cannot read counts as dangerous. Erasing the project history and mass deletes are blocked too. This stops mistakes and smuggled instructions; it is not a defence against a determined attacker.

Will all this checking slow my changes down?

Checking is proportional to risk. Copy, styles and documentation pass only the script checks; payments, logins and data get the full review. In version 1.8.0 I removed blocks that stopped normal work more often than they caught mistakes: for example, a change may now have up to 1,500 source lines before it must be split.

Who has the final say on risky changes?

I do. Logins, payments, changes to the database structure, outside libraries, the automatic test setup and the agents' own instructions never go live on their own; they wait until I type my phrase in the chat. The same words echoed in an agent's reply unlock nothing, and every use goes into the log.

Where do passwords and keys live?

In a vault on my own hardware: 165 keys, tokens and logins. A bridge passes a value straight into the process that needs it, so it never appears in the chat, the code or the logs. A secret typed into a command is blocked, and automatic scans keep secrets out of the code.

Could someone else take over my project?

That is a design goal. Every style decision answers one question: can a senior engineer who has never seen the repository run it in 15 minutes and find the place to change in 15 more? New repositories start from a template with automatic tests, and architecture decisions are written down with their evidence.

Does all this checking cost a lot?

It costs AI usage, so it is spent on purpose. Plain script checks that use no AI run first. AI reviewers run only where the risk is: about four times the cost of one review on a shared piece of code, eight to ten times on the riskiest changes such as payments. Copy and documentation changes get none.

Questions recruiters ask

What did you build yourself, and what did the AI do?

AI coding agents write the code. My part is the specification, the review and the deploy: I defined the problem from an audit, made the architecture decisions, set the limits and the approvals, and I decide what is risky enough to wait for me. I would not claim to have typed the code by hand.

What was the biggest failure?

A check that never ran. The push gate read its input twice, so it saw nothing and protected nothing for six days, and nothing noticed, because nothing tested the gate itself. Now every git hook has a test that runs the whole script with real input, so a gate that stops blocking turns a test red.

What did you learn from building it?

Rules written as text do not act; mechanisms that fire on an event do. Whoever wrote the code, a person or a model, does not see its own mistakes, so reviewers start with a clean slate. And proportion matters: since version 1.8.0 there is no new block without an incident behind it.

How do you know it works?

Every gate has a test proving it blocks, and the whole test suite has 730 checks. Mutation testing plants small bugs to prove the tests catch them. Before a new guard rule could block anything, it was replayed against real commands from my transcripts.

What would you do differently?

Measure before blocking. For weeks every risk I noticed got a new gate, until the gate log showed that some of them stopped normal work far more often than they caught a mistake. Since 1.8.0 a new check starts by only watching.

Why the name Higher Mind?

It comes from my other long project, a free guidebook on practical spirituality, whose rule is practice over belief. A rule you intend to follow is a belief; a check that runs on its own is a practice. PG is that higher mind above every coding session.

Can others use it?

Yes. The whole system is a public repository, cleaned of private data, which you can install in five minutes with Node 20+, git and Claude Code. Without --force the installer does not overwrite a file you changed, and it ends with a self-test, and the green output is the proof.

How fast does it change?

Sixteen public versions in 54 days, each answering something real: an audit, a comparison with 35 open-source projects, a failure, or friction in my own work. Since October 14 it is in maintenance mode: it changes after an incident, a broken hook or my request, not for its own sake.

Questions developers ask

Isn't this overengineering?

It is heavy, and it is proven at the scale of one owner, not a large company. But it audits itself: since 1.8.0 there is no new block without an incident, a new check starts by watching, and limits that got in the way were raised, like the change size, now 1,500 source lines. On October 14 I stopped adding mechanisms because more had started to cost more than it protected.

How is this different from CI and linters?

CI is one of its layers. PG also guards the agent while it works: at the prompt, after every edit, at every terminal command and when the session ends, then at commit and push. On top of that come reviewers with a clean slate, a catalogue of scars where every gate points to a real failure, and proof instead of claims.

What if an AI reviewer is wrong, or gets fooled?

Reviewers work independently and only read; a finding without proof is dropped; a script, not a model, combines them; and the verifier tries to disprove each one. The weak spot is the CI review: it is one model, a probabilistic proof that a crafted diff can try to talk around. That is why risky paths always wait for my phrase.

Can't the agent just get around the gates?

Small quality gates it may pass itself, and every pass is logged. Steps that cannot be undone need my phrase, typed by me; the same words in an agent's reply unlock nothing. The control layer is sealed with checksums. But the guard is built against mistakes and smuggled instructions, not a determined agent: running any script can do anything, and that case belongs to the sandbox.

How much does it cost in tokens?

Roughly four times one review at T2 and eight to ten at T3, with the free script checks first so no reviewer looks at red lint. The full rules go into the prompt once per session, then a one-line reminder. The context window stays at 400k, because in my transcripts 1M used about 2.3 times more of the weekly limit.

Why separate reviewers instead of one good model?

Whoever wrote the code does not see its own mistakes, so reviewers get only the change and the task and never see each other's findings: agents that discuss drift toward the majority. Each gets its own slice of the diff, because given a 9,799-line diff reviewers read about 10 to 30 % of it.

How are the gates themselves tested?

Every gate has a test that proves it blocks, and a script checks that every written rule has a gate. Mutation testing proves the tests catch planted bugs. Hooks, git gates and settings are sealed with checksums, and a change outside a window I opened shows up at the start of the next session.

Does it hold on a large codebase?

Consistency drifts in large systems through unwritten assumptions, so they are written where a script can read them: each architecture document has a block of layers and forbidden imports, and the push gate blocks a new import cycle. A file that more than 40 others import is flagged before an edit. Old cycles only warn.

Why is part of it in Polish?

The rules injected into the prompt have a full English version, and every block message has an English line with its escape hatch. The doctrine and the reviewer checklists are still in Polish; the model reads them fine, and the README is in both.

This page went through the process it describes: an agent drafted it, it passed the gates above and an AI review, and I reviewed and published it. The numbers came from commands run on the day it shipped, not from memory.