@rmyndharis/aimhooman 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/rules/aimhooman.md +9 -6
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/.clinerules/aimhooman.md +9 -6
- package/.codex-plugin/plugin.json +3 -3
- package/.cursor/rules/aimhooman.mdc +10 -7
- package/.github/copilot-instructions.md +9 -6
- package/.kiro/steering/aimhooman.md +9 -6
- package/.windsurf/rules/aimhooman.md +9 -6
- package/AGENTS.md +9 -6
- package/CHANGELOG.md +111 -0
- package/CONTRIBUTING.md +2 -3
- package/GEMINI.md +9 -6
- package/README.md +57 -376
- package/SECURITY.md +6 -4
- package/bin/aimhooman.mjs +134 -143
- package/docs/ai-artifacts.gitignore +63 -0
- package/docs/catalog.md +41 -0
- package/docs/cli-reference.md +114 -0
- package/docs/design/frictionless-enforcement.md +27 -17
- package/docs/faq.md +60 -0
- package/docs/integrations.md +108 -0
- package/docs/policy.md +82 -0
- package/docs/secrets.md +83 -0
- package/hooks/hooks.json +1 -1
- package/package.json +10 -2
- package/rules/paths.json +0 -114
- package/schemas/overrides.schema.json +4 -1
- package/skills/aimhooman/SKILL.md +11 -8
- package/src/args.mjs +2 -7
- package/src/exclude.mjs +2 -2
- package/src/gitx.mjs +1 -13
- package/src/hook.mjs +44 -12
- package/src/report.mjs +17 -41
- package/src/scan-session.mjs +15 -22
- package/src/scan-target.mjs +10 -10
- package/src/scan.mjs +9 -24
- package/src/state.mjs +104 -15
- package/rules/secrets.json +0 -96
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# CLI reference
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
aimhooman init | status | check | audit | scan | explain | allow | deny | override | review | policy-review | fix | doctor | uninstall | version
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Install and init
|
|
8
|
+
|
|
9
|
+
Node 22.8+ and Git 2.28+, zero runtime dependencies, ships as source. Git 2.28
|
|
10
|
+
is required for the prepared-phase reference transaction guard that checks
|
|
11
|
+
cherry-pick, revert, rebase, `git am`, and other ref-producing flows.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install -g @rmyndharis/aimhooman
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Guard a repository:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
aimhooman init # git hooks + local excludes; normally no worktree files
|
|
21
|
+
aimhooman init --gitignore # also write the managed AI-artifact block to the worktree .gitignore
|
|
22
|
+
aimhooman status
|
|
23
|
+
aimhooman uninstall # restore hooks/excludes; keep local policy state
|
|
24
|
+
aimhooman uninstall --purge-state # also delete common Git-directory state
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`init --gitignore` is the opt-in for teams that want the ignore set committed:
|
|
28
|
+
it writes the same managed pattern block into the worktree `.gitignore`,
|
|
29
|
+
records the choice in the local config, and prints a notice to commit the file
|
|
30
|
+
so every clone shares it. `status` shows the recorded choice, and `uninstall`
|
|
31
|
+
removes the block (and the file, if aimhooman created it and nothing else
|
|
32
|
+
remains). The default stays local: `.git/info/exclude` only.
|
|
33
|
+
|
|
34
|
+
Two honest edges. `uninstall` deletes the `.gitignore` itself only when
|
|
35
|
+
aimhooman created it and the removed block leaves it empty — if you committed
|
|
36
|
+
the file, that deletion is a tracked worktree deletion you then commit or
|
|
37
|
+
restore. And the opt-in record lives in the common Git directory, so linked
|
|
38
|
+
worktrees share the choice while each worktree keeps its own `.gitignore`.
|
|
39
|
+
|
|
40
|
+
For commits you make at the terminal (outside your AI tool), one global setup guards
|
|
41
|
+
eligible non-bare repositories that do not override `core.hooksPath` locally:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
aimhooman init --global --yes # advanced: change core.hooksPath after confirmation
|
|
45
|
+
aimhooman uninstall --global # unset it
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Global `core.hooksPath` changes Git behavior for repositories that inherit it and can
|
|
49
|
+
replace their default hook directory. A local or worktree-scoped override takes
|
|
50
|
+
precedence. Bare repositories are outside the worktree/index policy boundary and the
|
|
51
|
+
global dispatchers leave them unchanged. `status` shows both local and global values.
|
|
52
|
+
Prefer repository `init` unless the global ordering is understood.
|
|
53
|
+
|
|
54
|
+
When `core.hooksPath` is set, Git reads hooks only from that effective directory and
|
|
55
|
+
ignores `.git/hooks`. Repository `init` installs and chains predecessors only when
|
|
56
|
+
that directory is absent or is proven to be owned by the repository: inside it and
|
|
57
|
+
not tracked by Git. It refuses to modify a global, shared, external, or tracked
|
|
58
|
+
hook directory, because a dispatcher committed from one machine names paths that
|
|
59
|
+
exist only on that machine. Those repositories are not guarded, and there is no
|
|
60
|
+
way to guard them today. Calling `aimhooman precommit` from an existing hook
|
|
61
|
+
manager runs the check but registers no managed guard, so the agent hook still
|
|
62
|
+
refuses the commit. Remove the override before retrying, or accept that the
|
|
63
|
+
repository is unguarded and do not run `init` there.
|
|
64
|
+
|
|
65
|
+
Repository `init` installs `pre-commit`, `pre-merge-commit`, `commit-msg`, and
|
|
66
|
+
`reference-transaction`, and preserves an existing hook as a predecessor. For
|
|
67
|
+
`commit-msg`, aimhooman pins the would-be tree before the predecessor runs, so a later
|
|
68
|
+
index change cannot select a weaker policy. The prepared reference transaction is the
|
|
69
|
+
last local check for cherry-pick, revert, rebase, `git am`, fetch/worktree branch
|
|
70
|
+
creation, and direct branch-ref updates. Every profile stops if a predecessor removes
|
|
71
|
+
a required guard; the first running dispatcher that detects the loss aborts the
|
|
72
|
+
operation.
|
|
73
|
+
|
|
74
|
+
## Commands
|
|
75
|
+
|
|
76
|
+
`check` accepts one Git target (`--staged`, `--tracked`, `--commit <rev>`, or
|
|
77
|
+
`--range <base>...<head>`), plus `--message <file>`, `--profile`, and `--json`.
|
|
78
|
+
Commit and range targets read commit messages from Git automatically. A range scans each
|
|
79
|
+
introduced commit, so a bad file added and deleted before the endpoint is still reported.
|
|
80
|
+
Use an all-zero object ID as the base when there is no prior commit; this includes the root
|
|
81
|
+
commit. Deleting an ordinary forbidden path is not itself a finding, while removing or
|
|
82
|
+
lowering a versioned strict project policy still needs a bound policy review.
|
|
83
|
+
`audit` and `scan` are aliases for a full tracked-index scan.
|
|
84
|
+
`init --global --yes` and `uninstall --global` manage the advanced terminal-Git guard;
|
|
85
|
+
`uninstall --global` cannot be combined with the local `--purge-state` option.
|
|
86
|
+
`fix` follows the active profile: clean writes an exact safe repair, compliance makes no
|
|
87
|
+
change, and strict previews unless `--apply` is supplied.
|
|
88
|
+
`allow` resolves a finding by path or rule ID; an allow entry's scope is `path` or
|
|
89
|
+
`rule` (see [docs/policy.md](policy.md#overrides)).
|
|
90
|
+
|
|
91
|
+
On `clean` and `compliance`, `check`, `fix`, and the commit hooks warn and continue
|
|
92
|
+
when a scan is incomplete; `strict` exits 31 instead. The final ref guard
|
|
93
|
+
(`reference-transaction`) stays fail-closed on every profile and still vetoes what
|
|
94
|
+
it cannot fully scan.
|
|
95
|
+
|
|
96
|
+
Machine reports use `schema_version: 1` and include target policy identity, completeness,
|
|
97
|
+
scan statistics, commit and object metadata. Schemas are published in [`schemas/`](../schemas/).
|
|
98
|
+
|
|
99
|
+
For an existing repository, start with `aimhooman audit --json`. If a residue path is
|
|
100
|
+
already tracked, remove it from the index with `git rm --cached <path>` and add an
|
|
101
|
+
appropriate ignore/exclude. aimhooman does not scan for secrets; if one was committed,
|
|
102
|
+
rotate it first — [docs/secrets.md](secrets.md) covers why and what to run instead.
|
|
103
|
+
History cleanup is deliberately outside aimhooman's scope.
|
|
104
|
+
|
|
105
|
+
## Exit codes
|
|
106
|
+
|
|
107
|
+
| Code | Meaning |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| 0 | clean, or non-blocking review |
|
|
110
|
+
| 10 | policy violation (block) |
|
|
111
|
+
| 11 | review-required on a non-clean profile |
|
|
112
|
+
| 20 | usage, configuration, or rule-pack error |
|
|
113
|
+
| 30 | Git or I/O error |
|
|
114
|
+
| 31 | scan incomplete on `strict` or at the final ref guard (`clean`/`compliance` warn and continue) |
|
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
This document describes aimhooman's enforcement model. aimhooman is designed to
|
|
4
4
|
prevent known AI-tool residue from leaking into Git history **without editing
|
|
5
|
-
`.gitignore
|
|
6
|
-
Plugin startup provides best-effort prevention without `init`;
|
|
7
|
-
enforcement requires local or global hook setup.
|
|
5
|
+
`.gitignore` by default, and with repair before rejection on the default ordinary
|
|
6
|
+
commit path.** Plugin startup provides best-effort prevention without `init`;
|
|
7
|
+
complete Git-boundary enforcement requires local or global hook setup.
|
|
8
8
|
|
|
9
9
|
## Goals
|
|
10
10
|
|
|
11
11
|
- **Zero-activation for Claude Code:** the plugin is active every session
|
|
12
12
|
(SessionStart), no `init`.
|
|
13
|
-
- **No `.gitignore` burden:** known AI artifacts are auto-excluded via
|
|
14
|
-
`.git/info/exclude` (local, never committed
|
|
13
|
+
- **No `.gitignore` burden by default:** known AI artifacts are auto-excluded via
|
|
14
|
+
`.git/info/exclude` (local, never committed). `init --gitignore` is the opt-in
|
|
15
|
+
variant that writes the same managed block to the worktree `.gitignore`, so a
|
|
16
|
+
team can commit it and share the ignore set across clones.
|
|
15
17
|
- **Repair-first for hygiene by default:** AI artifacts are excluded before
|
|
16
|
-
staging or unstaged at commit. If a block cannot be repaired
|
|
17
|
-
pinned tree,
|
|
18
|
+
staging or unstaged at commit. If a block cannot be repaired or remains in the
|
|
19
|
+
pinned tree, the operation stops. An incomplete scan warns on
|
|
20
|
+
`clean`/`compliance` and stops on `strict`; the final ref guard stops on it
|
|
21
|
+
at every profile.
|
|
18
22
|
- **Broad, community-updatable rule catalog:** covers many AI tools; extendable
|
|
19
23
|
via PR (core) and local rules (personal).
|
|
20
24
|
- **Block remains available as opt-in** (`strict` profile) for teams that want
|
|
@@ -41,8 +45,9 @@ enforcement requires local or global hook setup.
|
|
|
41
45
|
3. **PreToolUse cannot unstage.** It runs before the tool executes; at `git add X`,
|
|
42
46
|
X is not staged yet. So unstage is a git-tier (`pre-commit`) capability; the
|
|
43
47
|
plugin tier does prevention (excludes) plus advisory (warn).
|
|
44
|
-
4. **`.gitignore` stays clean** because aimhooman writes
|
|
45
|
-
(local, not committed
|
|
48
|
+
4. **`.gitignore` stays clean by default** because aimhooman writes
|
|
49
|
+
`.git/info/exclude` (local, not committed). The opt-in `init --gitignore`
|
|
50
|
+
writes the same managed block to `.gitignore` for teams that want it committed.
|
|
46
51
|
|
|
47
52
|
## Design
|
|
48
53
|
|
|
@@ -54,16 +59,18 @@ enforcement requires local or global hook setup.
|
|
|
54
59
|
| 1. Catch-all | `pre-commit` hook unstages AI artifacts from the index | git hook | proceeds after repair; stops if repair fails |
|
|
55
60
|
| 2. Agent guard | PreToolUse reports paths and rejects unprovable protected Git mutations | plugin | advisory for paths; fail-closed for boundary bypass |
|
|
56
61
|
| 3. Strict policy | `strict` profile blocks instead of repairing (exit 10) | both | block |
|
|
57
|
-
| 4. Pinned tree | `commit-msg` checks the exact would-be tree and message | git hook | blocks a remaining violation
|
|
62
|
+
| 4. Pinned tree | `commit-msg` checks the exact would-be tree and message | git hook | blocks a remaining violation; an incomplete scan warns on clean/compliance, stops on strict |
|
|
58
63
|
| 5. Final ref check | prepared `reference-transaction` scans what each commit introduced to `HEAD` or a branch changes (and the message of commits authored locally) | git hook | blocks a violation or incomplete scan |
|
|
59
64
|
|
|
60
65
|
Default profile `clean` uses layers 0, 1, 2, 4, and 5. Successful repair keeps the
|
|
61
66
|
ordinary path low-friction. The pinned-tree and final-ref scans deliberately stop if
|
|
62
|
-
a block remains on a path the commit actually changes
|
|
67
|
+
a block remains on a path the commit actually changes. The final-ref scan also stops
|
|
68
|
+
when it is incomplete, on every profile; an incomplete pinned-tree scan warns on
|
|
69
|
+
`clean`/`compliance` and stops on `strict`.
|
|
63
70
|
A file already in history is not re-tried on every later commit: the final ref check
|
|
64
71
|
judges a commit by its change set, so an inherited path no longer blocks unrelated
|
|
65
72
|
work. Use `aimhooman check --tracked` (or scan the PR range in CI) to surface legacy
|
|
66
|
-
|
|
73
|
+
artifacts without bricking the branch.
|
|
67
74
|
Git 2.54 also emits an earlier `preparing` reference-transaction callback. The
|
|
68
75
|
hook checks dispatcher integrity there without scanning unresolved references,
|
|
69
76
|
then keeps the scan veto at `prepared`, after Git has locked them.
|
|
@@ -95,14 +102,15 @@ rather than run the command on its own, which is the friction this tier exists t
|
|
|
95
102
|
### Components
|
|
96
103
|
|
|
97
104
|
1. **Rule catalog** — `rules/paths.json`, `rules/attribution.json`,
|
|
98
|
-
`rules/markers.json
|
|
105
|
+
`rules/markers.json`. Covers Claude, Codex, Copilot, Cursor, Aider, SpecStory,
|
|
99
106
|
Continue, Playwright MCP, Remember, Superpowers, and a generic agent dir.
|
|
100
107
|
Community extends via PR (core); personal extensions via
|
|
101
108
|
`<common-git-dir>/aimhooman/rules/*.json` (local, shared by linked worktrees,
|
|
102
109
|
loaded after core, and only able to add restrictions).
|
|
103
110
|
2. **Auto-exclude** — `applyExclude` writes patterns derived from unambiguous
|
|
104
111
|
`ephemeral-state` and `local-settings` rules to `.git/info/exclude` from
|
|
105
|
-
SessionStart, init, and the agent guard.
|
|
112
|
+
SessionStart, init, and the agent guard. Review-required and policy paths
|
|
113
|
+
remain visible.
|
|
106
114
|
3. **Git boundary** — the `pre-commit` hook scans staged paths; for any AI
|
|
107
115
|
artifact it removes it from the index, then lets the commit proceed only when
|
|
108
116
|
that repair succeeds. `commit-msg` removes complete exact high-confidence attribution lines
|
|
@@ -133,8 +141,10 @@ means local rules only add restrictions and can never override a core block.
|
|
|
133
141
|
## Implementation notes
|
|
134
142
|
|
|
135
143
|
- **Category-aware failure.** On `clean`, a malformed local rule pack is skipped
|
|
136
|
-
with a warning because built-in rules remain active. Corrupt override state
|
|
137
|
-
unreadable Git inputs
|
|
144
|
+
with a warning because built-in rules remain active. Corrupt override state and
|
|
145
|
+
unreadable Git inputs stop every profile. An incomplete staged-content scan warns
|
|
146
|
+
on `clean`/`compliance` and stops `strict`; the final ref guard fails closed on it
|
|
147
|
+
at every profile.
|
|
138
148
|
Any automatic unstage failure stops; allowing it through would only defer the
|
|
139
149
|
same block to the pinned-tree or final-ref scan. `strict` also vetoes policy
|
|
140
150
|
findings and reviews.
|
|
@@ -146,7 +156,7 @@ means local rules only add restrictions and can never override a core block.
|
|
|
146
156
|
- **HEAD-safe unstage.** `git restore --staged` needs HEAD; on a repository's
|
|
147
157
|
initial commit it falls back to `git rm --cached --ignore-unmatch`.
|
|
148
158
|
- **Repair never mints an empty commit.** When the pre-commit repair unstages the last
|
|
149
|
-
staged path (stage only a `.
|
|
159
|
+
staged path (stage only a `.claude.json`, then `git commit`), it exits 10 so Git stops, the
|
|
150
160
|
same outcome as committing with nothing staged. Carrying on would create a commit Git
|
|
151
161
|
itself would have refused and leave the developer a junk commit to `git reset --hard`.
|
|
152
162
|
- **Anchored attribution rules.** The AI-noreply rule is anchored to trailer
|
package/docs/faq.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# FAQ
|
|
2
|
+
|
|
3
|
+
**Is this a way to hide AI use?** No. aimhooman removes operational residue and
|
|
4
|
+
establishes human ownership. It never changes author, committer, signature, or
|
|
5
|
+
timestamp, and the compliance profile keeps any disclosure your policy requires.
|
|
6
|
+
|
|
7
|
+
**Will it cancel my commits?** On the default `clean` profile, aimhooman first tries to
|
|
8
|
+
exclude or unstage hygiene artifacts and safely remove exact attribution lines. The
|
|
9
|
+
commit proceeds if no block remains; a scan that runs over budget warns and continues.
|
|
10
|
+
A pre-existing tracked block, failed unstage/repair, or unterminated exact attribution
|
|
11
|
+
still stops the operation, and the final `reference-transaction` guard vetoes a commit
|
|
12
|
+
it cannot fully scan, on every profile. `strict` cancels findings instead of repairing,
|
|
13
|
+
and treats an incomplete scan as a stop.
|
|
14
|
+
|
|
15
|
+
**Does it slow commits down?** The staged check runs locally with no network and reads
|
|
16
|
+
Git objects in batches. Text-oriented rules skip binary files. Size and total budgets
|
|
17
|
+
are visible in reports. Files over 2 MiB or a scan over 64 MiB make the scan
|
|
18
|
+
incomplete (binary files skip complete; oversized text is what trips it): direct
|
|
19
|
+
checks and the Git pre-commit guards warn on `clean`/`compliance` and stop on
|
|
20
|
+
`strict`, and the final ref guard stops on every profile rather than
|
|
21
|
+
claiming that content was checked.
|
|
22
|
+
|
|
23
|
+
**Can the agent bypass it?** Any local tool can ultimately be bypassed by a user with
|
|
24
|
+
commit access. The agent guard fails closed on what it cannot prove: empty, invalid,
|
|
25
|
+
or non-object hook JSON, missing managed final guards, and hook or receive-pack
|
|
26
|
+
indirection around protected ref mutations are denied on every profile, and `strict`
|
|
27
|
+
additionally rejects `--no-verify`, unknown executor shapes, and uncertain commit
|
|
28
|
+
execution. Read-only commands and pipelines run; the guard stands between the agent
|
|
29
|
+
and protected Git mutations, not between you and reading a repository. Git hooks are
|
|
30
|
+
not a sandbox: an editor or another local program started during a commit has the same
|
|
31
|
+
filesystem access and can change a later hook. Wrappers that can select another cwd or
|
|
32
|
+
filesystem namespace (`sudo`, `chroot`, WSL, sandbox launchers) fail closed on every
|
|
33
|
+
profile; retry as a direct Git command from the target repository. Treat local
|
|
34
|
+
executables and Git config as trusted. For team enforcement, scan the actual PR range
|
|
35
|
+
in CI (a normal CI checkout has no staged changes):
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
git fetch origin main
|
|
39
|
+
aimhooman check --range origin/main...HEAD --profile strict
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
On GitHub Actions, configure `actions/checkout` with `fetch-depth: 0` so the
|
|
43
|
+
triple-dot merge base is available.
|
|
44
|
+
|
|
45
|
+
`pre-commit` and `commit-msg` do not cover every sequencer or ref movement. The managed
|
|
46
|
+
`reference-transaction` hook therefore checks introduced commits during Git's prepared
|
|
47
|
+
phase and can abort the local ref update. Git 2.54's earlier `preparing` callback is
|
|
48
|
+
accepted for compatibility and checks guard integrity; scanning remains in `prepared`,
|
|
49
|
+
after references are locked.
|
|
50
|
+
CI still scans the exact pushed or PR history:
|
|
51
|
+
local hooks do not govern another clone, server-side updates, or history created before
|
|
52
|
+
the guard was installed.
|
|
53
|
+
Bare repositories have no worktree/index boundary and are not supported by local commands.
|
|
54
|
+
A submodule is a separate repository with separate state and hooks; run `aimhooman init`
|
|
55
|
+
inside each submodule that needs local enforcement.
|
|
56
|
+
|
|
57
|
+
**What about secrets?** aimhooman does not scan for secrets since v0.3.0 and never
|
|
58
|
+
did history cleanup. A committed credential is exposed: rotate it, then run a
|
|
59
|
+
dedicated scanner over the repository. [docs/secrets.md](secrets.md) explains the
|
|
60
|
+
reasoning and shows the gitleaks setup we recommend.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Integrations
|
|
2
|
+
|
|
3
|
+
aimhooman runs wherever commits get checked: as a pre-commit.com hook, as a
|
|
4
|
+
GitHub Action, and next to other hook tooling. This page shows each setup and
|
|
5
|
+
what it does and does not cover.
|
|
6
|
+
|
|
7
|
+
## pre-commit.com
|
|
8
|
+
|
|
9
|
+
The repository ships a `.pre-commit-hooks.yaml`, so pre-commit installs
|
|
10
|
+
aimhooman straight from Git. Add this to `.pre-commit-config.yaml` and run
|
|
11
|
+
`pre-commit install`:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
repos:
|
|
15
|
+
- repo: https://github.com/rmyndharis/aimhooman
|
|
16
|
+
rev: v0.3.0
|
|
17
|
+
hooks:
|
|
18
|
+
- id: aimhooman
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
pre-commit npm-installs the package at the pinned revision and runs
|
|
22
|
+
`aimhooman check --staged` on every commit. Pin `rev` to a tag and bump it
|
|
23
|
+
deliberately.
|
|
24
|
+
|
|
25
|
+
The hook checks the staged tree, so it passes no filenames. Any non-zero
|
|
26
|
+
exit fails it: 10 for a policy violation, 11 for a review-required finding on
|
|
27
|
+
a non-clean profile, 20 for a usage or configuration error, 30 for a Git or
|
|
28
|
+
I/O error, 31 when a scan budget leaves the scan incomplete on `strict` or at
|
|
29
|
+
the final ref guard (`clean`/`compliance` warn and continue). On the default
|
|
30
|
+
`clean` profile a review-only finding exits 0, so reviews alone do not fail
|
|
31
|
+
the hook. Blocks always do.
|
|
32
|
+
|
|
33
|
+
This hook is the CLI check only. It does not install aimhooman's managed Git
|
|
34
|
+
hooks or the agent guard; `aimhooman init` in the repository adds those.
|
|
35
|
+
|
|
36
|
+
## GitHub Actions
|
|
37
|
+
|
|
38
|
+
The repository root has an `action.yml`, so a workflow can scan the exact
|
|
39
|
+
pull request range:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
# .github/workflows/aimhooman.yml
|
|
43
|
+
name: aimhooman
|
|
44
|
+
on: [pull_request]
|
|
45
|
+
|
|
46
|
+
jobs:
|
|
47
|
+
check:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
with:
|
|
52
|
+
fetch-depth: 0
|
|
53
|
+
- uses: rmyndharis/aimhooman@v0.3.0
|
|
54
|
+
with:
|
|
55
|
+
base: ${{ github.event.pull_request.base.sha }}
|
|
56
|
+
head: ${{ github.event.pull_request.head.sha }}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`fetch-depth: 0` is required. The range is triple-dot, so the scan starts at
|
|
60
|
+
the merge base of the two commits, and a shallow checkout does not have that
|
|
61
|
+
commit. The action installs aimhooman from npm and defaults to the `strict`
|
|
62
|
+
profile; set `profile:` under `with:` to change that.
|
|
63
|
+
|
|
64
|
+
Pinning the action tag (`@v0.3.0`) pins only the action's steps, not the CLI:
|
|
65
|
+
the action npm-installs aimhooman at run time, and the `version` input
|
|
66
|
+
defaults to `latest`. Set `version:` under `with:` (for example
|
|
67
|
+
`version: 0.3.0`) to pin the CLI itself.
|
|
68
|
+
|
|
69
|
+
For `push` events, use `base: ${{ github.event.before }}` and
|
|
70
|
+
`head: ${{ github.event.after }}`. On the first push to a branch `before` is
|
|
71
|
+
all zeros; `aimhooman check --range` accepts an all-zero base and includes
|
|
72
|
+
the root commit in the scan.
|
|
73
|
+
|
|
74
|
+
CI is the enforcement tier that travels with the repository: local hooks do
|
|
75
|
+
not govern another clone, and a laptop can skip its own hooks. The action
|
|
76
|
+
cannot.
|
|
77
|
+
|
|
78
|
+
## Secrets
|
|
79
|
+
|
|
80
|
+
aimhooman does not scan for secrets. Pair it with
|
|
81
|
+
[gitleaks](https://github.com/gitleaks/gitleaks), either as a pre-commit.com
|
|
82
|
+
hook or as a second CI job next to the action above.
|
|
83
|
+
[docs/secrets.md](secrets.md) explains why the built-in scanner was removed
|
|
84
|
+
and shows both gitleaks setups.
|
|
85
|
+
|
|
86
|
+
## husky
|
|
87
|
+
|
|
88
|
+
husky sets `core.hooksPath` to `.husky`. `aimhooman init` refuses to install
|
|
89
|
+
into or over an external or shared hooks directory by design: `.husky` is
|
|
90
|
+
tracked repository content, and a dispatcher written there would stage this
|
|
91
|
+
machine's absolute CLI and Node paths for everyone who clones
|
|
92
|
+
(`src/githooks.mjs` has the full rule set). Two ways out:
|
|
93
|
+
|
|
94
|
+
- Keep husky and call `aimhooman check --staged` from `.husky/pre-commit`.
|
|
95
|
+
You get the CLI check only. The agent-tier guard (PreToolUse) asks for
|
|
96
|
+
aimhooman's own managed hooks and refuses guarded commits without them, so
|
|
97
|
+
agent-driven commits stay unguarded in this setup.
|
|
98
|
+
- Drop husky for the guarded hooks and let `aimhooman init` manage them.
|
|
99
|
+
Existing hooks are not lost: init preserves each one as a chained
|
|
100
|
+
predecessor, and the dispatcher runs it before its own check.
|
|
101
|
+
|
|
102
|
+
## lint-staged
|
|
103
|
+
|
|
104
|
+
lint-staged builds a list of staged files and runs one command per batch.
|
|
105
|
+
aimhooman does not fit that shape: it reads the whole index and commit from
|
|
106
|
+
Git and takes no file list, so a per-batch invocation would check the same
|
|
107
|
+
index several times. Run it at hook level instead, through its own managed
|
|
108
|
+
hooks or the pre-commit.com setup above.
|
package/docs/policy.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Team policy and overrides
|
|
2
|
+
|
|
3
|
+
aimhooman's per-clone defaults serve a solo developer. This page covers the
|
|
4
|
+
team layer: a versioned policy file, owner-authorized changes to protected
|
|
5
|
+
paths in CI, local overrides, and local rule packs.
|
|
6
|
+
|
|
7
|
+
## Versioned team policy
|
|
8
|
+
|
|
9
|
+
Commit `.aimhooman.json` when every clone should use the same baseline:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"schema_version": 1,
|
|
14
|
+
"profile": "strict"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The project policy takes precedence over the per-clone profile written by `init`.
|
|
19
|
+
An individual `check` may escalate to `--profile strict`, but cannot weaken or replace
|
|
20
|
+
the team profile. Malformed project policy fails closed with an actionable error;
|
|
21
|
+
personal allow/deny exceptions and local rule packs remain in the common Git directory
|
|
22
|
+
under `aimhooman/`.
|
|
23
|
+
Under `strict`, policy files and agent instructions are blocking findings (exit 10):
|
|
24
|
+
both rules' strict action is `block`, not review. The product's `review` and
|
|
25
|
+
`policy-review` commands record local, object-bound decisions. An ordinary path or
|
|
26
|
+
rule allow does satisfy those engine findings; the one finding an allow cannot
|
|
27
|
+
satisfy is the strict-policy downgrade-or-removal block, which is constructed
|
|
28
|
+
outside the engine and clears only through a bound `policy-review` acknowledgment.
|
|
29
|
+
|
|
30
|
+
### Owner authorization in CI
|
|
31
|
+
|
|
32
|
+
For a protected-path change, CI verifies the pinned repository and owner login plus
|
|
33
|
+
numeric IDs through the GitHub API, then inspects the exact workflow-run attempt.
|
|
34
|
+
GitHub must attribute both `actor` and `triggering_actor`, including their numeric IDs,
|
|
35
|
+
to that owner. CI then binds the authorization to the exact head, transition commit,
|
|
36
|
+
path, resulting blob and regular-file mode, or deletion tombstone. A strict-policy
|
|
37
|
+
migration also binds its old and new policy objects. A different attempt, commit, path
|
|
38
|
+
result, mode, or policy transition needs fresh authorization. A change not attributed to
|
|
39
|
+
the owner fails closed. This is owner authorization verified through GitHub attribution,
|
|
40
|
+
not independent review.
|
|
41
|
+
|
|
42
|
+
## Overrides
|
|
43
|
+
|
|
44
|
+
Every decision has a rule ID, so you can resolve a finding narrowly:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
aimhooman allow AGENTS.md --reason "shared team config" # stop flagging this path
|
|
48
|
+
aimhooman deny path/or/rule-id # always block it
|
|
49
|
+
aimhooman explain claude.session-state # why a rule fires
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Overrides live in the repository's common Git directory under
|
|
53
|
+
`aimhooman/overrides.json` (local, never committed), so linked worktrees share them.
|
|
54
|
+
An allow entry's scope is `path` or `rule`.
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
aimhooman override list --json
|
|
58
|
+
aimhooman override remove AGENTS.md
|
|
59
|
+
aimhooman override reset --all
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Secret scanning left the product in v0.3.0, and the `secret-path` allow scope went
|
|
63
|
+
with it: existing `secret-path` entries are dropped on load with a warning, and the
|
|
64
|
+
rest of the file keeps working. Use a dedicated scanner for credentials instead —
|
|
65
|
+
[docs/secrets.md](secrets.md) explains the reasoning and shows the gitleaks setup.
|
|
66
|
+
|
|
67
|
+
## Local rule packs
|
|
68
|
+
|
|
69
|
+
Add your own per-repository detection with local rule packs in the common Git directory
|
|
70
|
+
under `aimhooman/rules/*.json`
|
|
71
|
+
(the structural schema is in [`schemas/rule-pack.schema.json`](../schemas/rule-pack.schema.json);
|
|
72
|
+
local rules only add detection — they can't weaken
|
|
73
|
+
a built-in block). Within one rule, local content patterns are capped at 32 expressions,
|
|
74
|
+
512 characters per expression, and 4,096 characters total. Path and exception scopes
|
|
75
|
+
share the same glob count, per-expression, and total limits. They use a flat subset: literals,
|
|
76
|
+
character classes, anchors, dot, escapes, and fixed `{n}` repeats. Groups, alternation,
|
|
77
|
+
lookaround, backreferences, and variable quantifiers are rejected. A local expression
|
|
78
|
+
does not run on a line longer than 16,384 characters; that skip is reported and makes the
|
|
79
|
+
scan incomplete. Path rules are case-sensitive by default. Set
|
|
80
|
+
`match.path_case` to `"insensitive"` only for a security name whose meaning is
|
|
81
|
+
case-insensitive, such as `.env`; matching folds that rule's candidate and patterns but
|
|
82
|
+
does not change the Git path or override identity.
|
package/docs/secrets.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Secrets and aimhooman
|
|
2
|
+
|
|
3
|
+
aimhooman v0.3.0 removed built-in secret scanning. This page explains why and
|
|
4
|
+
shows the setup we recommend instead.
|
|
5
|
+
|
|
6
|
+
## Why the built-in scanner went away
|
|
7
|
+
|
|
8
|
+
aimhooman does one job: it keeps AI tooling residue (session files, local
|
|
9
|
+
state, AI attribution) out of Git history. Secret scanning is a different
|
|
10
|
+
craft. A serious scanner tracks hundreds of credential formats, tunes for
|
|
11
|
+
entropy and false positives, and ships pattern updates on its own cadence.
|
|
12
|
+
aimhooman's eight rules could not keep up with that, and a scanner that only
|
|
13
|
+
sometimes works is worse than none: it reads as coverage it never had. Use a
|
|
14
|
+
tool that does secrets full-time. We recommend [gitleaks](https://github.com/gitleaks/gitleaks).
|
|
15
|
+
|
|
16
|
+
Two things do stay. The agent-facing policy still tells agents never to commit
|
|
17
|
+
secrets, because an instruction costs nothing. And a local rule pack can still
|
|
18
|
+
declare `category: "secret"`; findings from such a rule keep their matched
|
|
19
|
+
text redacted in every report.
|
|
20
|
+
|
|
21
|
+
## Recommended setup: gitleaks
|
|
22
|
+
|
|
23
|
+
### Pre-commit hook (pre-commit.com)
|
|
24
|
+
|
|
25
|
+
Add this to `.pre-commit-config.yaml` and run `pre-commit install`:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
repos:
|
|
29
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
30
|
+
rev: v8.30.1
|
|
31
|
+
hooks:
|
|
32
|
+
- id: gitleaks
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The hook scans staged changes and stops the commit when a credential shows
|
|
36
|
+
up. Pin `rev` and bump it deliberately.
|
|
37
|
+
|
|
38
|
+
### GitHub Action
|
|
39
|
+
|
|
40
|
+
Laptops bypass hooks; CI should not. Add a workflow step that scans pull
|
|
41
|
+
requests:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
# .github/workflows/gitleaks.yml
|
|
45
|
+
name: gitleaks
|
|
46
|
+
on: [push, pull_request]
|
|
47
|
+
jobs:
|
|
48
|
+
scan:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
with:
|
|
53
|
+
fetch-depth: 0
|
|
54
|
+
- uses: gitleaks/gitleaks-action@v2
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`fetch-depth: 0` gives the action the full history so a secret introduced
|
|
58
|
+
three commits back still gets caught.
|
|
59
|
+
|
|
60
|
+
### Running it alongside aimhooman
|
|
61
|
+
|
|
62
|
+
The two tools do not overlap and do not fight. aimhooman owns Git's
|
|
63
|
+
`pre-commit`, `commit-msg`, and `reference-transaction` hooks; gitleaks runs
|
|
64
|
+
as a pre-commit.com hook or in CI, so both fire on the same commit without
|
|
65
|
+
sharing state. A commit carrying an AI session file and an API key gets
|
|
66
|
+
stopped for both reasons, each reported by the tool that owns it. Keep
|
|
67
|
+
aimhooman for AI hygiene, keep gitleaks for secrets, and let each report in
|
|
68
|
+
its own words.
|
|
69
|
+
|
|
70
|
+
## Migrating from the built-in scanner
|
|
71
|
+
|
|
72
|
+
Two escape hatches left with the scanner:
|
|
73
|
+
|
|
74
|
+
- `aimhooman allow <path> --scope secret-path` is gone. Existing
|
|
75
|
+
`secret-path` entries in `overrides.json` are dropped on load with a
|
|
76
|
+
warning; the rest of the file keeps working.
|
|
77
|
+
- `aimhooman init --grandfather-secrets` is gone.
|
|
78
|
+
|
|
79
|
+
If secrets already sit in your history, aimhooman was never the fix and
|
|
80
|
+
removing it changes nothing about that: a committed credential is exposed.
|
|
81
|
+
Rotate it, then run `gitleaks git` (or `gitleaks detect`) over the repository
|
|
82
|
+
to find anything else that needs rotation. Scrubbing history is optional and
|
|
83
|
+
secondary; rotation is not.
|
package/hooks/hooks.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rmyndharis/aimhooman",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "AI works. Hoomans ship. Keep AI session files
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "AI works. Hoomans ship. Keep AI session files and attribution out of your commits.",
|
|
5
5
|
"homepage": "https://github.com/rmyndharis/aimhooman#readme",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
"hooks/",
|
|
22
22
|
"schemas/",
|
|
23
23
|
"docs/hosts.json",
|
|
24
|
+
"docs/ai-artifacts.gitignore",
|
|
25
|
+
"docs/catalog.md",
|
|
26
|
+
"docs/secrets.md",
|
|
27
|
+
"docs/policy.md",
|
|
28
|
+
"docs/cli-reference.md",
|
|
29
|
+
"docs/faq.md",
|
|
30
|
+
"docs/integrations.md",
|
|
24
31
|
"docs/design/",
|
|
25
32
|
"docs/logo/",
|
|
26
33
|
".claude-plugin/",
|
|
@@ -47,6 +54,7 @@
|
|
|
47
54
|
"check": "node scripts/validate.mjs",
|
|
48
55
|
"sync:hosts": "node scripts/sync-hosts.mjs",
|
|
49
56
|
"sync:ruleset": "node scripts/sync-ruleset.mjs",
|
|
57
|
+
"sync:catalog": "node scripts/sync-catalog.mjs",
|
|
50
58
|
"test": "node --import ./tests/test-env.mjs --test",
|
|
51
59
|
"test:coverage": "node --import ./tests/test-env.mjs --experimental-test-coverage --test-coverage-include=\"src/**\" --test-coverage-include=\"bin/**\" --test-coverage-include=\"scripts/authorize-owner-paths.mjs\" --test-coverage-include=\"scripts/github-owner-authority.mjs\" --test-coverage-include=\"scripts/package-manifest.mjs\" --test-coverage-include=\"scripts/scan-ci-history.mjs\" --test-coverage-exclude=\"tests/**\" --test-coverage-lines=75 --test-coverage-branches=60 --test-coverage-functions=85 --test-reporter=spec --test-reporter=./scripts/coverage-threshold.mjs --test-reporter-destination=stdout --test-reporter-destination=stderr --test",
|
|
52
60
|
"check:static": "node scripts/static-gates.mjs",
|