2026-11-26 15:39 UTC

Axiom offers local pre-write checks for coding agents

state: watchingheat: mediumuncertainty: mediumrelevance: mediumcoding-agents agent-security developer-toolsAxiom CSC

What is this?

Axiom is an MIT-licensed, local guardrail for AI coding agents, published by Axiom CSC on GitHub. Its README describes a pre-write hook for Claude Code and Cursor, plus a manually wired stdin/stdout mode for other agents. It checks proposed changes against configurable project invariants and can allow, block, or ask for clarification; the README says checks are pattern- and AST-based, not semantic, and documents ways they can be bypassed. The Hacker News post links directly to the repository; no separate announcement or independent validation is included in the supplied evidence.

Why it matters

Axiom illustrates a practical way to put policy checks between a coding agent and file changes: teams can define limits and other invariants that an agent should not invent or exceed, and get an interruption before a write. Its local, no-API design may make this accessible to developers who want lightweight controls. But the checks cover patterns, not meaning, and the maintainer explicitly describes it as a first line of defense rather than an adversarially robust security boundary.

Current assessment

The new development in this evidence is a publicly available repository describing a local pre-write guardrail for coding agents. According to its README, installation can register hooks for Claude Code and Cursor; other agents can use a pipe-based interface if wired manually, while the listed VS Code/Copilot task flags issues after a write rather than blocking beforehand. Users configure invariants in YAML; the tool claims to block detected violations or halt for clarification. The maintainer says it runs locally with no API keys or dependencies and that telemetry is off by default. These are repository claims, not independently verified performance or adoption evidence. The README documents material gaps: pattern-based extraction can miss expressions, variables, encoded payloads and cross-file constraints; renamed paths and other obfuscations may evade checks, and a compromised environment can bypass the hook. The author also characterizes it as a first line of defense. It could offer teams a low-friction way to encode some project rules at the point an agent proposes a change, but should not be treated as a substitute for review, CI checks, isolation or other controls. The supplied sources establish the project and its stated capabilities, not how reliably it works in practice or how widely it is used.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 494h
points/hour across evidence Β· reading as of 2026-11-27 02:23:58.509736+11:00 Β· deterministic, not a model opinion

How the heat travelled

11-06 01:23 (minted)⭐ origin echo-reconstructedThis GitHub repository is the originating artifact linked by the HN post. Its README begins β€œAxiom β€” Local Guardrail for AI Coding Agents” a
Axiom CSC (the repository identifies Naren Saravanan as founder/researcher on the linked Axiom Labs site; repo attribution itself is the organization) on github (echo) Β· attributed from hn.story.50386839 Β· published time unknown
β€”
11-06 01:00first on hacker news Β· published Β· lag ?Axiom – blocks AI agents from inventing limits your code never defined
nsara11
β€”
11-06 01:00amplified on hacker news πŸ‘‘hn.story.50386839
nsara11
peak 1 Β· 1 comments Β· 103% of case engagement
11-06 01:20our radar first saw it Β· lag ?discovery anchor: hn.story.50386839β€”
pace: p26 vs 1845 stories at the 336h mark (now 494h old) β€” ahead of adap-delegated-authority-protocol-draft (2.0x), behind abmaze-protein-fitness-agent-benchmark (0.7x)

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnAxiom – blocks AI agents from inventing limits your code never defined
Retrieved article excerpt

Open article Β· Retrieved 2026-11-06T01:21:57.633699+00:00

# Axiom β€” Local Guardrail for AI Coding Agents

[Hook](https://camo.githubusercontent.com/5ae9286cbad3071a7c1a2770b87a2f5b3291b5d47e279f1127224af22aef5c05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f686f6f6b2d507265546f6f6c5573652d626c7565)
[Python](https://camo.githubusercontent.com/066693bae94b6797e3354a50bbd7bd8157a1a6b95c8d082a9ceb3b1a768dc052/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e382532422d626c7565)
[Agents](https://camo.githubusercontent.com/1e43e2b68f25f659f5633f4816c04c4af00ffbc60d4aebc07eae1f0f1caccaff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6167656e74732d436c61756465253230436f6465253230253743253230437572736f722532302537432532304169646572253230253743253230436f70696c6f742d6f72616e6765)
[License](https://camo.githubusercontent.com/be07a68b57a673af622198c336264f89d82bf4cd5d87bc0cb3f7b6ae47cc43ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c6967687467726579)

Axiom is a local guardrail for AI coding agents. It runs as a pre-write hook in Claude Code and Cursor, and as a stdin/stdout filter for any agent that can pipe tool calls through a subprocess. Zero dependencies. No API keys. No tokens. Blocks before the write.

[Axiom blocking a payment limit violation](https://github.com/axiom-csc/axiom-skill/blob/main/demo.gif)

> Detection is regex and AST-pattern based, not semantic. A motivated agent or attacker can bypass these checks with minor obfuscation. This tool catches the most common accidental violations, not adversarial ones. For adversarial resistance, pair it with container isolation and branch protection.

```
       [ Claude Code / AI Agent Pipeline ]
                        |
                ( PreToolUse Hook )
                        |
+───────────────────────────────────────────────────+
|                 Axiom Core Engine                  |
| +─────────────────────────────────────────────+   |
| |   Noema: Scope-Aware AST Lowering Pipeline  |   |
| +─────────────────────+───────────────────────+   |
|                       |                           |
| +─────────────────────+───────────────────────+   |
| |   Lemma: Relational Logic Solver (Python)   |   |
| +─────────────────────+───────────────────────+   |
|                       |                           |
| +─────────────────────+───────────────────────+   |
| |   Manam: Tri-State Epistemic Controller     |   |
| +─────────────────────+───────────────────────+   |
+───────────────────────────────────────────────────+
                        |
        +───────────────+───────────────+
        v                               v
  [TRUE / FALSE]                   [UNKNOWN]
  (Permit Tool Run)             (Fail-Closed Halt)
```

## Install

```
# Project-level (recommended)
curl -fsSL https://raw.githubusercontent.com/axiom-csc/axiom-claude-skill/v1.2.2/install.sh | bash

# Global β€” all projects on this machine
curl -fsSL https://raw.githubusercontent.com/axiom-csc/axiom-claude-skill/v1.2.2/install.sh | bash -s -- --global
```

That's it. The installer downloads the hook, registers it in `.claude/settings.json`, and generates `.axiom/invariants.yaml` from your codebase β€” all in one step. Axiom runs automatically in every Claude Code and Cursor session from this point on.

**Why `curl | bash` is safe here:** The installer is a bash script that downloads 6 Python files and registers a hook in `.claude/settings.json`. It makes no network calls after install, never runs as root, and writes only to your project directory (or `~/.claude/` with `--global`). Read it: <https://github.com/axiom-csc/axiom-claude-skill/blob/v1.2.2/install.sh>

For additional agents:

```
curl -fsSL .../install.sh | bash -s -- --agents=cursor          # Claude Code + Cursor
curl -fsSL .../install.sh | bash -s -- --agents=cursor,vscode   # + VS Code file-save task
```

## Uninstall

```
bash install.sh uninstall
```

## How it works

| Pass | Component | What it does |
| --- | --- | --- |
| 1 | **Noema** | Extracts typed constraints from task context via regex patterns |
| 2 | **Lemma** | Evaluates them against your invariants (deterministic Python logic) |
| 3 | **Manam** | Enforces 3-state logic: TRUE / FALSE / UNKNOWN |

**On UNKNOWN** β€” Claude halts and asks the exact right question.
**On FALSE** β€” Claude outputs an `AxiomConstraintViolation` and stops.

## Agent compatibility

| Agent | Mode | Blocking? |
| --- | --- | --- |
| Claude Code | PreToolUse hook via `.claude/settings.json` | Yes β€” blocks before write |
| Cursor | `.cursor/hooks.json` (same format) | Yes β€” blocks before write |
| Aider / Continue / generic | `--stdin` mode (pipe JSON tool call) | Yes β€” if wired manually |
| VS Code + Copilot | File-save task (`.vscode/axiom-task.json`) | No β€” flags after write |

**Generic `--stdin` mode** β€” any agent that can pipe JSON through a subprocess:

```
echo '{"tool_name":"Write","tool_input":{"file_path":"src/auth/middleware.py","content":"if user.id==1: return True"}}' \
  | python3 .claude/skills/axiom-csc/hooks/pre_tool_use.py --stdin
# exit 1 = deny, exit 2 = ask, exit 0 = allow
```

## What it catches

| Category | What Axiom catches | Known gaps |
| --- | --- | --- |
| **Payments / numeric bounds** | Hardcoded limits that don't match your policy | Limits stored in variables (`max = 10000; amount > max`); math expressions β€” `MAX_TRANSACTION = 10000 * 8` is read as `10000`, not `80000` |
| **Auth: hardcoded ID** | `user.id == 1` checks in auth paths (AST-based) | Aliased variables more than one hop deep |
| **Auth: unconditional return** | `if True: return True` in auth paths | Complex conditional chains |
| **Auth: role literals** | `"admin"`, `"root"` in non-config auth files | Config files exempt by design; non-English role names |
| **Auth: commented checks** | `# check permission` in auth files | Non-English comments |
| **Dangerous Bash** | DROP TABLE, rm -rf (non-tmp), curl|bash, writes to .axiom/ | Multi-line commands, heredocs, commands via Python subprocess; encoded payloads piped to bash (`base64 -d | bash`, xxd, hex decode patterns) |
| **Secrets** | AWS keys, Stripe live/test keys, OpenAI keys, PEM blocks, hardcoded passwords | Secrets stored in variables before assignment; base64-encoded secrets |
| **Dependency confusion** | Misspellings of requests, numpy, flask, django, express, react, lodash, axios | Packages not in the hardcoded known list |
| **Rate limits** | Invented req/min values | Values in separate config files |
| **File uploads** | Assumed size caps | Caps expressed in bytes not MB |
| **Database** | Arbitrary LIMIT clauses | LIMIT in comments or strings |
| **API quotas** | Made-up daily call limits | Quotas in env vars |

Auth checks are **path-scoped** β€” they only fire in files under `auth/`, `middleware/`, `permissions/`, or `roles/`. The same pattern in `src/utils/helpers.py` is allowed.

Auth bypass detection uses Python's `ast` module, so whitespace and simple aliases don't bypass it.

## Before / after example

**Without Axiom** β€” agent sets MAX\_TRANSACTION higher than policy allows:

```
# Claude writes:
MAX_TRANSACTION = 75000   # raised for enterprise tier
```

**With Axiom** (hook fires immediately on the Edit call):

```
❌ [Lemma BLOCK] AxiomConstraintViolation: transaction_value = 75000.0 violates lte 50000
[axiom-csc] Invariant violation: ❌ [Lemma BLOCK] AxiomConstraintViolation: transaction_value = 75000.0 violates lte 50000
```

Claude sees the denial reason and asks for clarification instead of silently writing the bad value.

To record the demo GIF: install [vhs](https://github.com/charmbracelet/vhs) (`brew install charmbracelet/tap/vhs`), then run:

```
vhs scripts/demo.tape
```

Or record with asciinema: `asciinema rec demo.cast && bash scripts/record_demo.sh` β€” upload the `.cast` file to asciinema.org and embed the link here.

## Demo β€” Auth pattern detection (new)

**Without Axiom:**

```
# Claude writes to src/auth/middleware.py:
if user.id == 1:
    return True   # hardcoded ID bypass
```

**With Axiom:**

```
❌ [Lemma BLOCK] AxiomConstraintViolation: auth_hardcoded_id = 1 violates banned true
[axiom-csc] Invariant violation: auth_hardcoded_id β€” hardcoded user ID check detected in auth path
```

## Modes

| Mode | Trigger | Behavior |
| --- | --- | --- |
| STRICT | *(default)* | Halt on any UNKNOWN or violation |
| AUDIT | `[AXIOM: AUDIT]` | Execute + append telemetry block |
| REPAIR | `[AXIOM: REPAIR]` | Auto-rewrite violations before output |

## Usage

```
# Check telemetry status
python3 .claude/skills/axiom-csc/scripts/axiom.py telemetry status

# Enable / disable telemetry
python3 .claude/skills/axiom-csc/scripts/axiom.py telemetry on
python3 .claude/skills/axiom-csc/scripts/axiom.py telemetry off

# Submit a false positive / false negative case
python3 .claude/skills/axiom-csc/scripts/axiom.py report
```

## Custom rules

Edit `.axiom/invariants.yaml` (auto-generated by `axiom_init.py`):

```
rules:
  - concept: transaction_value
    op: lte
    value: 50000
    action_on_fail: BLOCK

  - concept: dangerous_bash
    banned: true
    action_on_fail: BLOCK

  - concept: secret_pattern
    banned: true
    action_on_fail: BLOCK

  - concept: dep_confusion
    banned: true
    action_on_fail: BLOCK

  - concept: role_assignment
    required: true
    action_on_missing: ASK
```

**Rule fields:**

| Field | Meaning |
| --- | --- |
| `op: lte` + `value: N` | Fail if extracted numeric value exceeds N |
| `banned: true` | Fail if any matching entity is found in the tool call |
| `required: true` | Ask for clarification if the entity is not found |

## Known limitations

| Limitation | Why |
| --- | --- |
| Semantic bypasses | An agent can write `50000 + 25000` or put values in variables β€” Noema extracts literals only |
| Container escape | Axiom runs inside the agent's process; a compromised container can bypass the hook entirely |
| Single call scope | The hook sees one tool call at a time β€” invariants spread across files are not checked |
| Path-scope bypass | Auth checks only cover the four named directories; a renamed auth module is not caught |
| Edit-distance coverage | Dependency confusion uses a fixed known-package list β€” typos against unlisted packages are missed |

Axiom is a first line of defense, not a complete security layer. Use it alongside proper code review, CI checks, secret scanning (gitleaks), and least-privilege infrastructure.

## Privacy

Telemetry is **off by default**. When enabled:

**What is sent:**

- A random install ID (uuid4, not tied to your machine or account)
- Timestamp, decision (allow/ask/deny), rule ID, tool name, latency, skill version, OS name, Python version

**What is NEVER sent:**

- Tool input, code, file paths, file names, shell commands
- Contents of `invariants.yaml`, env vars, CWD, or project names

**How to turn off:**

```
python3 .claude/skills/axiom-csc/scripts/axiom.py telemetry off
```

Or set `"telemetry": false` in `~/.config/axiom-csc/config.json`.

`axiom report` is always **manual**: you pick the case, review the redacted payload, and explicitly type `yes` to submit. Reports become public GitHub issues under CC-BY-4.0.

See [PRIVACY.md](https://github.com/axiom-csc/axiom-skill/blob/main/PRIVACY.md) for full details.

## FAQ

**Q: Why not use Claude Code's plugin marketplace?**

Claude Code's plugin marketplace distributes MCP servers and slash-command skills β€” it does not currently support PreToolUse hooks, which is the hook type this tool requires to block before a write happens. Installing via this script is the only supported path until Anthropic adds marketplace support for hooks. When they do, we'll publish there.

## Contributing

See [CONTRIBUTING.md](https://github.com/axiom-csc/axiom-skill/blob/main/CONTRIBUTING.md). Good first issues tagged on GitHub β€” S3 file size extractor, Kubernetes quota templates, Supabase RLS parser.

## License

MIT Β· [Axiom CSC](https://github.com/axiom-csc)
nsara1111
🟧 echo.github ⭐This GitHub repository is the originating artifact linked by the HN post. Its README begins β€œAxiom β€” Local Guardrail for AI Coding Agents” aAxiom CSC (the repository identifies Naren Saravanan as founder/researcher on the linked Axiom Labs site; repo attribution itself is the organization)β€”β€”

Interpretation history

Decision trace