{"_id":"@kym6464/claude-state","_rev":"2-4679f9caf27ac7fea25e82e17dff62bc","name":"@kym6464/claude-state","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.4":{"name":"@kym6464/claude-state","version":"0.1.4","keywords":["claude","claude-code","hooks","state"],"license":"ISC","_id":"@kym6464/claude-state@0.1.4","maintainers":[{"name":"kym6464","email":"muradovkamal10@gmail.com"}],"homepage":"https://github.com/kym6464/claude-state#readme","bugs":{"url":"https://github.com/kym6464/claude-state/issues"},"bin":{"claude-state":"cli.sh"},"dist":{"shasum":"8f4c944910acb93f5d5113ba30eab5bcaa452365","tarball":"https://registry.npmjs.org/@kym6464/claude-state/-/claude-state-0.1.4.tgz","fileCount":6,"integrity":"sha512-zpjhM6a2VP1gNfhYR3eknOJ3CSAEqvoKXTykHu1ejqkeM49/iLtiLU0sVmnehu98Kn/E8ppIZH4VKQKoIXCzYA==","signatures":[{"sig":"MEYCIQD/fEFPwnJghboNK0QiWglIJ8s54vp+sXyOePfztONi3QIhANDBBd97PM3WkXOmFvAUTMj5E4w4OvxmwAhg0iN1jENv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8477},"gitHead":"9fa413a7226a019ecb64d128411cf7a4f6f26aca","_npmUser":{"name":"kym6464","email":"muradovkamal10@gmail.com"},"repository":{"url":"git+https://github.com/kym6464/claude-state.git","type":"git"},"_npmVersion":"11.6.2","description":"A lightweight CLI for managing session-scoped state in Claude Code hooks","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/claude-state_0.1.4_1774907316178_0.8052430743028534","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@kym6464/claude-state","version":"0.1.5","description":"A lightweight CLI for managing session-scoped state in Claude Code hooks","bin":{"claude-state":"cli.sh"},"repository":{"type":"git","url":"git+https://github.com/kym6464/claude-state.git"},"keywords":["claude","claude-code","hooks","state"],"license":"ISC","bugs":{"url":"https://github.com/kym6464/claude-state/issues"},"homepage":"https://github.com/kym6464/claude-state#readme","gitHead":"eea7122a6a24853227fbbd24dfcd03287e194f07","_id":"@kym6464/claude-state@0.1.5","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-JlzeVWtEds7jByJKtBwsG8kGpBh74z3ypFbDhxY9zDrlFXz5ZqwAc14qncW1nKA+Wsfn0GiXj9emPmnwFa/ZSw==","shasum":"a2e28c2a6ee71774b8129229af778b9037c8b94f","tarball":"https://registry.npmjs.org/@kym6464/claude-state/-/claude-state-0.1.5.tgz","fileCount":6,"unpackedSize":8477,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@kym6464%2fclaude-state@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDk+j+OKa25sTillLnpTNHx0+VVMIrnj0gPqSIEvIxWPwIhANX0nl3vZ+fgWWHyx4MPxG/vSJ6+rgBtF16W0OdQd2S0"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:11fcfe1e-fa29-4bf3-ad00-bcd3d8276fb8"}},"directories":{},"maintainers":[{"name":"kym6464","email":"muradovkamal10@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/claude-state_0.1.5_1774907417518_0.057753929027357875"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-30T21:48:36.110Z","modified":"2026-03-30T21:50:17.950Z","0.1.4":"2026-03-30T21:48:36.322Z","0.1.5":"2026-03-30T21:50:17.663Z"},"bugs":{"url":"https://github.com/kym6464/claude-state/issues"},"license":"ISC","homepage":"https://github.com/kym6464/claude-state#readme","keywords":["claude","claude-code","hooks","state"],"repository":{"type":"git","url":"git+https://github.com/kym6464/claude-state.git"},"description":"A lightweight CLI for managing session-scoped state in Claude Code hooks","maintainers":[{"name":"kym6464","email":"muradovkamal10@gmail.com"}],"readme":"# claude-state\n\nA lightweight CLI for managing session-scoped state in [Claude Code hooks](https://code.claude.com/docs/en/hooks).\n\n## Why\n\nClaude Code hooks often need to track state across a session (e.g., \"only nudge once\", \"remember if lint errors were pre-existing\"). Without a shared mechanism, each hook invents its own marker files, polluting `/tmp` and duplicating logic.\n\n`claude-state` provides a single key-value store per session, scoped automatically by `session_id`.\n\n## Installation\n\n```bash\nbrew install kym6464/tap/claude-state\n```\n\n## Usage\n\n```\nclaude-state [--session-id <id>] <command> <key> [value]\n```\n\n### Commands\n\n| Command           | Description               | Exit code              |\n| ----------------- | ------------------------- | ---------------------- |\n| has <key>         | Check if a key exists     | `0` if set, `1` if not |\n| get <key>         | Print the value of a key  | `1` if not set         |\n| set <key>         | Set a flag (boolean true) |                        |\n| set <key> <value> | Set a key to a value      |                        |\n| delete <key>      | Remove a key              |                        |\n| list              | Print all key-value pairs |                        |\n\n### Session ID\n\nBy default, `claude-state` reads the hook's JSON input from stdin to extract `session_id`. This means in the simple case you don't need to pass anything — just pipe stdin through.\n\nIf your hook needs stdin for other purposes, pass the session ID explicitly:\n\n```bash\nclaude-state --session-id <id> <command> <key> [value]\n```\n\n### Storage\n\nState is stored in `${TMPDIR:-/tmp}/claude-state/<session_id>.json`. Each session gets its own file, automatically created on first write.\n\n## Examples\n\n### Simple hook — only fire once per session\n\nA `PostToolUse` hook that provides feedback to Claude, but only the first time:\n\n```bash\n#!/bin/bash\nclaude-state has migration_warning_sent && exit 0\nclaude-state set migration_warning_sent\ncat <<'EOF'\n{\n  \"hookSpecificOutput\": {\n    \"hookEventName\": \"PostToolUse\",\n    \"additionalContext\": \"This project uses v2 of the config format. See docs/migration.md before making changes.\"\n  }\n}\nEOF\n```\n\n### Hook that also reads stdin\n\nWhen your hook needs to inspect the tool input/output in addition to managing state, capture stdin first and pass the session ID explicitly:\n\n```bash\n#!/bin/bash\nINPUT=$(cat)\nSESSION_ID=$(echo \"$INPUT\" | jq -r '.session_id')\n\nclaude-state --session-id \"$SESSION_ID\" has deprecation_warning_sent && exit 0\n\nif echo \"$INPUT\" | grep -q 'legacyApi'; then\n  claude-state --session-id \"$SESSION_ID\" set deprecation_warning_sent\n  # ... output nudge JSON\nfi\n```\n","readmeFilename":"README.md"}