pkinative-mcp
CLAUDE.md0 starsChanged 20 days agoMITView on GitHub
Everything in AGENTS.md applies. This file adds only what is specific to Claude Code sessions in this repository. - Run tests through npx tsx scripts/gate.ts --fast or npx vitest run <file> (the dot reporter is configured); never paste a full test run into context. - Never Read dist/, coverage/, test-output/, package-lock.json, nodemodules/, tests/fixtures/tool-shape*.json or tests/fixtures/samples.sha256.json. The deny list in .claude/settings.json applies to Read and, at best effort, to Grep/Glob — ask the built server (tools/list, prompts/get, describeengine) instead of reading…
- Commits and pushes
We split this CLAUDE.md into the rules it gives an agent
10 rules. About 0 are common, 0 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Run tests through npx tsx scripts/gate.ts --fast or npx vitest run <file> (the dot reporter is configured).
- Very specific: line 10
Never Read dist/, coverage/, test-output/, package-lock.json, node_modules/, tests/_fixtures/tool-shape*.json or …
- Very specific: line 13
Read README.md, ROADMAP.md, docs/KNOWLEDGE_BASE.md and docs/AGENT_CONTRACT.md by section: grep -n "^## " first, then a line range.
- Very specific: line 16
Never push, never open PRs/issues/releases, never tag (HITL policy, hook-enforced).
- Very specific: line 22
When the gate exceeds the shell timeout, run it in the background and read the result with --json.
- Very specific: line 38
Write such strings through Edit, never through echo or a heredoc.
- Very specific: line 44
Always drive the built server (node dist/cli.js.
- Very specific: line 65
Use plan mode for multi-file changes.
- Very specific: line 67
Never edit a rule: edit the instruction file, then regenerate (verify:docs rule claude-rules-sync fails on drift).
- Very specific: line 73
Follow CONTRIBUTING.md §Release and scripts/release-prepare.ts: prepare everything (version lock-step, changelog, release note, manifest, …
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
@AGENTS.md
Claude Code addendum
Everything in AGENTS.md applies. This file adds only what is specific to Claude Code sessions in this repository.
Token discipline
- Run tests through
npx tsx scripts/gate.ts --fastornpx vitest run <file>(the dot reporter is configured); never paste a full test run into context. - Never Read
dist/,coverage/,test-output/,package-lock.json,node_modules/,tests/_fixtures/tool-shape*.jsonortests/_fixtures/samples.sha256.json. The deny list in.claude/settings.jsonapplies to Read and, at best effort, to Grep/Glob — ask the built server (tools/list,prompts/get,describe_engine) instead of readingdist/. - A tool's inputs are in
src/tools/<name>.ts; a shared fragment (pki-input,signer,trust,limits,parse-context,output, …) is one Grep away insrc/*.ts.tools/listis about 428 kB: project it, never print it. - Read README.md, ROADMAP.md, docs/KNOWLEDGE_BASE.md and docs/AGENT_CONTRACT.md by section:
grep -n "^## "first, then a line range. CHANGELOG.md: only the top entry. .github/instructions/*.mdare the per-area rules: open the ONE matching the area you touch (table in AGENTS.md §Where is what).- Sample regeneration:
npm run build && npm run test:generatethennpx tsx scripts/verify-samples.ts. Any--update(rebaseline) must be justified in the release note. - Never push, never open PRs/issues/releases, never tag (HITL policy, hook-enforced). No
Co-Authored-Bytrailers (attribution.commitis"").
Gate
npx tsx scripts/gate.ts --fastbefore proposing a commit;npm run gateis the CI profile;--publish --require-allon release branches only.--only <step>for one step,--from <step>to resume,--jsonfor machine output; logs intest-output/.gate/<step>.log— open only the failing step's log, through the shell.- When the gate exceeds the shell timeout, run it in the background and read the result with
--json. - OpenSSL 3 is the external judge (the role veraPDF plays in pdfnative-mcp):
validate:pkiandinteropSKIP without it and fail under--require-all. There is no veraPDF here.
Where to look first
src/tools/_registry.tsandsrc/tools/_group-*.ts— the catalogue intools/listorder;src/server.ts— prompts, instructions, the cache gate;tests/_fixtures/tool-shape.json— every pinned schema shape (read it by tool, never whole).- AGENTS.md §Where is what — the path → purpose → instruction-file table.
docs/assets/ecosystem.json— every count and version;npm run verify:docsenforces it.src/tools/describe-engine.ts— the doctrine (DOCTRINE) and the deliberately unexposed exports;src/wrapper-codes.tsandsrc/pki-errors.ts— every code with its remedy.
Secrets gotcha
The fixtures under tests/fixtures/pki/ are public TEST-ONLY material (password test-only-password), but the discipline is the real one:
never print a key body, a scalar or a password in a result, a log line, a test name or a document. assertResultClean (tests/_pki-assert.ts)
and the needle table (tests/_secrets.ts) hold every key-bearing result; the gate's dist-probe step refuses a build that carries a needle.
Write such strings through Edit, never through echo or a heredoc.
Stdout gotcha
On stdio, stdout IS the protocol: one stray console.log in src/ corrupts every session (the gate's smoke step fails on any non-JSON-RPC line).
Log to stderr through the [pkinative-mcp] logger; every engine call runs with the diagnostics sink installed, so the engine's console.warn fallback never fires.
Always drive the built server (node dist/cli.js; harness: tests/_mcp-harness.ts, tests/_agent-client.ts), not just source tests, before claiming a change works.
Windows session notes
- The session shell is PowerShell, with Git Bash as the Bash tool. PowerShell swallows
--afternpm run— callnpx tsx scripts/<name>.tsdirectly. - Multi-line
node -epayloads and heredocs break on backticks,$and backslashes: write a script to the scratchpad and run it. - OpenSSL: an OpenSSL 3.x build on
PATH(the one shipped with Git for Windows works), orOPENSSL_BINpointing atopenssl.exe;openssl versionmust say OpenSSL 3.x — LibreSSL is refused with the reason. - zlint / pkilint (publish profile only):
ZLINTnames the binary,PKILINT_PYTHONthe Python that importspkilint. npm installunder npm 10.9 can fail with an arboristedgesOuterror on a fresh resolution;npx npm@11.19.1 installworks,npm ciis unaffected.- vitest sometimes reports "no tests" right after a file write: run it again.
Hooks and permissions in force
.claude/hooks/guard.mjs(PreToolUse on Bash and PowerShell) deniesnpm publish/unpublish/deprecate/dist-tag,gh pr|issue create|edit|close|comment,gh pr merge,gh release, writinggh apiand anygit push— in every shell segment,$( )/backticks andsh -c/pwsh -Command/node -epayloads (a quoted string holding one is refused too: write such strings with Edit). The maintainer submits those — prepare, then stop.tests/tools/guard.test.tsis the contract.permissions.denyblocks Read on the generated bulk files above and the same write commands, for both shells;permissions.allowpre-approvesnpm run,npx vitest,npx tsx scripts/*,npx tsc,npx eslint,node scripts/*,node -eand read-only git.node dist/cli.jsis asked each time.
Plan mode, rules and skills
- Use plan mode for multi-file changes; plans name the files, the commands and the expected gate outcome. Run
/code-reviewon the branch diff before drafting a PR body. .claude/rules/*.mdare generated from.github/instructions/*.instructions.mdbynpm run agents:rules(scoped bypaths:= the sourceapplyTo). Never edit a rule: edit the instruction file, then regenerate (verify:docsruleclaude-rules-syncfails on drift)./release-audit [release-notes/vX.Y.Z.md] [previous-tag](.claude/skills/release-audit/) is the maintainer-invoked pre-release audit: two auditors, an adversarial verifier, an agent-autonomy pass and a GO/NO-GO ledger under.audit/.
Release
Follow CONTRIBUTING.md §Release and scripts/release-prepare.ts: prepare everything (version lock-step, changelog, release note, manifest,
PR draft under .github/drafts/, npx tsx scripts/gate.ts --publish --require-all) and stop before pushing.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- release-auditSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

