Skip to content

Standard Operating Procedures (SOPs)

Standard Operating Procedures (SOPs) form the core policy layer of Intutic. They define corporate compliance rules, architectural guidelines, security policies, and cost caps that govern autonomous AI coding agents at runtime.


SOP Data Model Schema

Every SOP is stored in the database registry and projects the following data structure:

typescript
interface SopRegistryEntry {
  sopId: string;               // Unique ID prefixed with 'sop_'
  workspaceId: string;         // Owning workspace reference
  title: string;               // Human-readable title
  version: string;             // SemVer string (default: 1.0.0)
  markdownContent: string;     // The natural language rule or V8 script body
  contentHash: string;         // SHA-256 integrity hash of content
  riskTier: 'LOW' | 'MEDIUM' | 'HIGH';
  complexityTier: 'TIER_1' | 'TIER_2' | 'TIER_3';
  isActive: boolean;           // Active status toggle
  lifecycleState: 'DRAFT' | 'UNDER_REVIEW' | 'ACTIVE' | 'ARCHIVED';
  sopType: 'standard' | 'hook'; // Standard markdown rule vs. executable hook script
  hookPhase?: 'PRE_TOOL' | 'POST_TOOL' | 'PRE_RESPONSE' | 'POST_RESPONSE';
}

SOP Formats

Intutic supports two distinct formats of SOPs depending on whether the rule is meant for human-in-the-loop validation or machine-enforceable runtime scripting:

1. Standard SOPs

Standard SOPs are authored in natural language markdown. They represent corporate policies (e.g., "Do not use deprecated cryptographic functions") and are used by:

  • LLMProbe: Running LLM-as-a-judge checks against prompt inputs and outputs.
  • Hindsight Memory: Enhancing context retrieval and matching active files against historical patterns.

2. Hook SOPs

Hook SOPs contain JavaScript code blocks executed dynamically inside Node's sandboxed V8 execution context during active agent operations.


V8 Isolate Script execution

For hook-type SOPs, scripts are executed synchronously at designated pipeline phases.

Phase Triggers

  • PRE_TOOL: Fires before a tool call is executed.
  • POST_TOOL: Fires immediately after a tool completes execution.
  • PRE_RESPONSE: Fires before sending request payloads to the model.
  • POST_RESPONSE: Fires immediately after receiving model completions.

Injected Context (intutic.context)

Every script runs in a isolated context where it has read-only access to runtime metadata via the global intutic.context object:

typescript
interface HookContext {
  sessionId: string;
  workspaceId: string;
  toolName?: string;
  toolArguments?: string;
  model?: string;
  responseContent?: string;
  estimatedCostUsd?: number;
  trustScore?: number;
  metadata?: Record<string, unknown>;
}

Setting the Verdict (intutic.verdict)

To enforce rules, the script must synchronously call intutic.verdict() with the policy outcome:

javascript
// Example: Block unauthorized git pushes
if (intutic.context.toolName === 'run_command') {
  const args = intutic.context.toolArguments || '';
  if (args.includes('git push') && args.includes('--force')) {
    intutic.verdict({
      action: 'block',
      reason: 'Force push to git repositories is strictly prohibited by security policy.'
    });
  }
}

Verdict Options:

  • allow: No action taken. Proceed with the run.
  • block: Terminate the operation and return the specified reason.
  • modify: Alter the request or output payload. Requires providing modifiedContent.
  • warn: Complete the run but record a policy warning in the audit logs.

Sandbox Security Constraints

To ensure isolation and performance safety:

  • No System Access: No access to require(), process, fs (filesystem), or the network.
  • Execution Limits: Strict CPU timeout limit of 100ms per execution run.
  • Size Limits: Maximum script size capped at 64KB.
  • Namespace whitelist: Access is restricted to standard JavaScript APIs (console.log, Math, JSON, Date, etc.).

Lifecycle Transitions

SOP lifecycle states are tracked sequentially in the database. Every state change creates an audit record:

[ DRAFT ] ──> [ UNDER_REVIEW ] ──> [ ACTIVE ] ──> [ ARCHIVED ]

Each change projects metadata detailing the creator user, review tickets, and the migration hashes proving policy integrity.

The active firewall for AI agents