claude-sentinel
v2.0.19
Published
Local-first agent observability, policy, and audit platform for Claude Code
Maintainers
Readme
claude-sentinel
Local-first observability, policy, and audit tooling for Claude Code workspaces.
claude-sentinel exists to capture Claude Code hook activity into a project-local SQLite database, evaluate policy signals, expose live runtime state over HTTP and MCP, and keep packaged skill metadata available to operator tooling without requiring a hosted backend.
Why it exists
Claude Code workflows can be difficult to inspect after the fact. claude-sentinel adds a local runtime that helps you:
- capture hook events into a workspace-scoped audit trail
- inspect sessions, execution trees, metrics, and policy hits
- expose the runtime through an MCP server for Claude-aware integrations
- preserve governed skill metadata shipped in
.claude/andai/skills/
The current runtime model is project-scoped. Running claude-sentinel init prepares the active workspace under .claude/sentinel/.
Package contents published to npm
The npm package is intentionally limited by package.json to the runtime artifacts needed for execution:
Because the package already uses the whitelist in package.json, an .npmignore file is not needed for publish readiness.
Requirements
- Node.js
>=18.0.0as declared inpackage.json - npm for install and publish workflows
- a local environment that can install
better-sqlite3
Native dependency note
claude-sentinel depends on better-sqlite3, which is a native module. Prebuilt binaries often cover common platforms, but some environments may still require native compilation support during install. If your install falls back to building from source, you may need:
- Python and C/C++ build tooling appropriate for your platform
- on Windows, Visual Studio Build Tools or an equivalent native toolchain
If npm install fails while building better-sqlite3, fix the native toolchain first and retry the package install.
Installation
Global CLI install
npm install -g claude-sentinelOne-off usage with npx
npx claude-sentinel helpLocal development install from source
npm install
npm run buildQuick start
From the workspace you want to observe:
claude-sentinel init
claude-sentinel start
claude-sentinel doctorWhat those commands do:
claude-sentinel initcreates the project runtime directories under.claude/sentinel/, prepares ignore entries, and configures inline hooks when not plugin-managedclaude-sentinel startlaunches the local HTTP runtime API on4242and the packaged browser UI on4243claude-sentinel doctorvalidates runtime home, database access, hook registration, process status, startup logging, the runtime API health endpoint athttp://127.0.0.1:4242/api/health, and the UI health endpoint athttp://127.0.0.1:4243/api/health
After startup, the packaged runtime exposes the local API at http://127.0.0.1:4242 through src/server/index.ts and serves the packaged Next browser UI at http://127.0.0.1:4243 from the published standalone build artifacts.
Public commands exposed by the package
The package exposes these npm bin commands through package.json:
| Command | Purpose |
|---|---|
| claude-sentinel | Main CLI for workspace initialization, lifecycle, diagnostics, and MCP helper startup |
| sentinel-hook | Low-level hook entrypoint used by Claude hook integration |
| sentinel-worker | Worker/flusher entrypoint |
| sentinel-server | HTTP runtime server entrypoint |
| sentinel-mcp | Standalone MCP stdio server entrypoint |
For most users, only claude-sentinel is the intended direct entrypoint. The other commands are primarily runtime plumbing and advanced integration surfaces.
CLI usage
claude-sentinel currently supports these commands:
| Command | Description |
|---|---|
| claude-sentinel init | Prepare the current workspace runtime and hook configuration |
| claude-sentinel start | Start the local runtime API and packaged browser UI for the current workspace |
| claude-sentinel status | Show whether the current workspace runtime API and browser UI are running |
| claude-sentinel stop | Stop the current workspace runtime API and browser UI |
| claude-sentinel doctor | Run health and configuration checks for both services |
| claude-sentinel mcp-server | Launch the MCP server via the main CLI |
| claude-sentinel help | Print command help |
Examples
Initialize and start Sentinel for the current project:
claude-sentinel init
claude-sentinel startCheck runtime status:
claude-sentinel statusStop the runtime:
claude-sentinel stopRun diagnostics:
claude-sentinel doctorStart the MCP server directly:
sentinel-mcpOr through the main CLI:
claude-sentinel mcp-serverMCP usage
The package includes MCP metadata in package.json and a stdio server implementation in src/mcp/index.ts.
Direct MCP command
sentinel-mcpPackage MCP metadata
Package consumers that read npm MCP metadata can resolve the server as:
- command:
node - args:
dist/mcp/index.js
MCP tools currently exposed
src/mcp/tools.ts defines the current public MCP tool surface:
get_skill_system_summaryget_skill_definitionrecommend_skill_routeexecute_skill_control_planeget_recent_eventssearch_audit_logexecute_sentinel_commandget_active_sessionsget_execution_treeget_policy_violationsget_audit_decisionsget_metrics
Claude Code plugin-managed flow
If you are using the Claude Code plugin packaging documented in plugin/README.md, the plugin can register hooks and the MCP server without mutating .claude/settings.json. In that mode, claude-sentinel init detects CLAUDE_PLUGIN_ROOT and skips inline hook mutation.
HTTP runtime surface
The local runtime server in src/server/index.ts exposes endpoints including:
GET /api/healthGET /api/streamGET /api/events/recentGET /api/sessionsGET /api/tree/:sessionIdGET /api/metrics/summaryGET /api/searchGET /api/projectsGET /api/policiesGET /api/policy-hitsGET /api/decisionsGET /api/skill-system
The packaged local runtime API defaults to port 4242 through DEFAULT_PORT. The packaged Next UI uses port 4243, matching ui/package.json, and is built into the published package during npm run build.
Configuration summary
The public configuration surface is intentionally small and mostly environment-variable based.
Workspace resolution
CLAUDE_PROJECT_DIRorCLAUDE_PROJECT_PATH: overrides the workspace path resolved byresolveProjectPath()
Plugin-managed execution
CLAUDE_PLUGIN_ROOT: signals plugin-managed installation toisPluginManagedInstall()CLAUDE_PLUGIN_DATA: alternate plugin data directory used bysentinel-hook
Retention settings
SENTINEL_RETENTION_DAYS: overrides event retention days ingetDefaultConfig()SENTINEL_ARCHIVE_RETENTION_DAYS: overrides archive retention days ingetDefaultConfig()SENTINEL_COMPRESS_ARCHIVES: set tofalseto disable archive compression ingetDefaultConfig()
Default runtime paths
Within a workspace, Sentinel uses the following defaults from src/shared/constants.ts:
- runtime home:
.claude/sentinel - database:
.claude/sentinel/sentinel_active.db - spool:
.claude/sentinel/spool - archive:
.claude/sentinel/archive - runtime state:
.claude/sentinel/runtime
Minimal library usage
The package root currently re-exports the shared module through src/index.ts. This is a conservative utility surface, not a broad application SDK.
Available exports come from src/shared/index.ts and include:
- shared constants such as
DEFAULT_PORT - path helpers such as
getProjectRuntimeHome()andresolveProjectPath() - redaction helpers from
src/shared/redaction.ts - skill-system helpers from
src/shared/skill-system.ts
Example CommonJS usage:
const { DEFAULT_PORT, getProjectRuntimeHome } = require('claude-sentinel');
console.log(DEFAULT_PORT);
console.log(getProjectRuntimeHome(process.cwd()));Consumers should treat this root export surface as low-level and subject to change outside the CLI and MCP contract.
Runtime behavior and publish caveats
- the package is CLI-first; the main supported product surface is the local runtime plus CLI and MCP entrypoints
- the runtime is currently workspace-scoped, not a fully implemented global daemon, as indicated by
src/cli/index.ts - successful use depends on Claude hook execution or equivalent runtime inputs; a fresh install with no events will naturally show limited data
- users installing from npm need the package to include built
dist/output; the publish flow enforces that withprepublishOnly
Development and build
Install dependencies:
npm installBuild the package:
npm run buildUseful scripts from package.json:
| Script | Purpose |
|---|---|
| npm run clean | Remove dist/ |
| npm run build | Compile TypeScript and run scripts/prepare-package.cjs |
| npm run lint | Type-check without emitting files |
| npm run pack:check | Inspect npm package contents with npm pack --dry-run |
| npm run publish:dry | Run npm publish --dry-run |
| npm run prepublishOnly | Clean and rebuild before a real publish |
scripts/prepare-package.cjs verifies that published bin targets exist and ensures each generated executable has a Node shebang.
Publishing notes for maintainers
For first public npm publish readiness:
- confirm
package.jsonmetadata remains accurate for version, license, engines, files, and bin entries - run
npm install - run
npm run clean - run
npm run build - run
npm run pack:check - run
npm run publish:dry - inspect the tarball contents to confirm it includes
dist/,migrations/,.claude/, andai/skills/artifacts expected by runtime and MCP flows - publish only after confirming npm account, package name ownership, and registry access outside this repository
The maintainer-oriented checklist is documented in MAINTAINER_RELEASE.md.
License
MIT. See LICENSE.
