How prasad0706/innovahack-localclaude works
Purpose and Runtime
Sentinel is a Node.js/MongoDB system for governing agent-driven transactions: authenticate administrators, register agents and credentials, evaluate policy, execute simulated wallet actions, and retain auditable decision traces. A separate Vite/React frontend provides operational dashboards.
Backend startup is backend/index.js; frontend startup is frontend/src/main.jsx and frontend/src/App.jsx. The demo entry point is backend/scripts/demoRunner.js.
API Composition and System Control
The backend is organized as route-backed domains mounted from the server entry point. System-level state and operational controls—including overview/status and kill-switch-like controls—are concentrated in:
• backend/index.js
• backend/system/systemRoutes.js
• backend/system/systemState.js
These controls form a cross-cutting execution boundary: transaction and workflow processing should observe system state before allowing action.
Identity, Agents, and Credentials
Administrator authentication uses JWT-oriented middleware and an admin persistence model:
• backend/auth/authRoutes.js
• backend/auth/authMiddleware.js
• backend/auth/Admin.js
Agents are managed independently through:
• backend/agents/Agent.js
• backend/agents/agentRoutes.js
Credential management persists credentials and encapsulates credential operations:
• backend/credential-manager/Credential.js
• backend/credential-manager/credentialService.js
• backend/credential-manager/credentialRoutes.js
This separates human/operator authorization, agent identity, and secrets/credential lifecycle.
Policy-to-Decision Pipeline
Policies are stored and exposed through a dedicated policy engine:
• backend/policy-engine/Policy.js
• backend/policy-engine/policyEngine.js
• backend/policy-engine/policyRoutes.js
The engine is the primary decision boundary between a requested agent action and execution. Its outputs are surfaced by the frontend decision-oriented views, notably:
• frontend/src/pages/DecisionViewerPage.jsx
• frontend/src/pages/PolicyManagementPage.jsx
Workflows, Gateway, and Execution
Workflows model orchestrated multi-stage activity:
• backend/workflow/Workflow.js
• backend/workflow/workflowRoutes.js
• backend/workflow/index.js
Transaction ingress and transaction records are handled by:
• backend/gateway/gatewayRoutes.js
• backend/gateway/Transaction.js
Approved execution reaches a wallet simulator rather than an indicated external blockchain/payment provider:
• backend/wallet/walletSimulator.js
• backend/wallet/index.js
The principal control flow is: authenticated operator/agent request → gateway/workflow → system-state and policy evaluation → simulated wallet execution or denial → persisted transaction and audit evidence.
Cryptographic Integrity Boundary
Cryptographic utilities support confidential credentials and tamper-evident request/decision handling:
• backend/crypto/aesGcm.js
• backend/crypto/signature.js
• backend/crypto/canonicalJson.js
Supporting key, fingerprint, nonce, and timestamp modules indicate protections against replay and inconsistent signed payload serialization. The master encryption key is supplied as SENTINEL_MEK; JWT signing uses JWT_SECRET.
Auditability and Operations UI
Audit records and audit service APIs provide the durable trace layer:
• backend/audit/AuditLog.js
• backend/audit/auditService.js
• backend/audit/auditRoutes.js
The React UI consumes backend APIs through:
• frontend/src/services/api.js
Operational views cover live transactions, workflows, audit logs, agents, credentials, policies, and system controls, with core examples at:
• frontend/src/pages/LiveTransactionsPage.jsx
• frontend/src/pages/WorkflowMonitorPage.jsx
• frontend/src/pages/AuditLogsPage.jsx
Material infrastructure is Node.js 18+, npm, MongoDB (local or Atlas), environment-provided secrets, and the locally simulated wallet execution layer.
Main entry points: index.js Backend entry · policyEngine.js Policy engine · gatewayRoutes.js Transaction gateway · auditService.js Audit service
Components 20
Backend services
Node.js route domains and execution pipeline.
- Backend entry · Mounts route-backed domains and system controls.
backend/index.js - System controls · Execution gate for status and kill-switch controls.
backend/system/systemState.js - Transaction gateway · Accepts transaction requests and records their outcomes.
backend/gateway/gatewayRoutes.js - Transaction records
backend/gateway/Transaction.js - Workflow orchestration · Coordinates multi-stage agent activity.
backend/workflow/index.js - Policy engine · Approves or denies requested agent actions.
backend/policy-engine/policyEngine.js - Policies
backend/policy-engine/Policy.js - Wallet simulator · Local simulated wallet execution target.
backend/wallet/walletSimulator.js - Audit service · Writes and exposes durable decision traces.
backend/audit/auditService.js - Audit logs
backend/audit/AuditLog.js
Identity & integrity
Operator access, credential protection, and signed payload handling.
- Admin authentication · Authorizes administrator API access.
backend/auth/authMiddleware.js - Administrators
backend/auth/Admin.js - Agents · Maintains independent agent identities.
backend/agents/agentRoutes.js - Credential service · Manages persisted credentials.
backend/credential-manager/credentialService.js - Credentials
backend/credential-manager/Credential.js - Crypto integrity · Protects credentials and canonical signed payloads.
backend/crypto/aesGcm.js
Operations UI
Vite/React dashboards for operational control.
- React operations UI · Operational dashboards and decision views.
frontend/src/App.jsx - API client
frontend/src/services/api.js - Decision viewer
frontend/src/pages/DecisionViewerPage.jsx - Workflow monitor
frontend/src/pages/WorkflowMonitorPage.jsx
Connections 27
- React operations UI → API client: uses
- React operations UI → Decision viewer: renders
- React operations UI → Workflow monitor: renders
- API client → Backend entry: calls
- Backend entry → Admin authentication: protects routes with
- Admin authentication → Administrators: verifies
- Backend entry → Transaction gateway: mounts
- Backend entry → Workflow orchestration: mounts
- Backend entry → Policy engine: mounts
- Backend entry → Audit service: mounts
- Backend entry → System controls: mounts controls
- Transaction gateway → System controls: checks state
- Workflow orchestration → System controls: checks state
- Transaction gateway → Policy engine: evaluates action
- Workflow orchestration → Policy engine: evaluates stages
- Policy engine → Policies: loads
- Policy engine → Wallet simulator: approved execution
- Transaction gateway → Transaction records: persists
- Policy engine → Audit service: decision trace
- Wallet simulator → Audit service: execution evidence
- Audit service → Audit logs: persists
- Agents → Credential service: uses credentials
- Credential service → Credentials: persists
- Credential service → Crypto integrity: encrypts with
- Policy engine → Crypto integrity: verifies signed payloads
- Decision viewer → API client: reads decisions
- Workflow monitor → API client: reads workflows