Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/memory / / ProceduralMemory

Class: ProceduralMemory

Defined in: packages/memory/src/tiers/procedural-memory.ts:101

ProceduralMemory - standing orders activated when the agent's current context matches the rule's predicate. The activation rules are deterministic so the agent runtime + ContextEngine can render the active set into the system prompt every step.

P2-2 adds ProceduralMemory.induce: distil a reusable workflow from a successful agent trajectory and store it quarantined (it must not drive actions until validated). Quarantined procedures are excluded from ProceduralMemory.activate but remain visible to ProceduralMemory.list.

Stable

Constructors

Constructor

ts
new ProceduralMemory(args): ProceduralMemory;

Defined in: packages/memory/src/tiers/procedural-memory.ts:112

Parameters

ParameterType
args{ inducer?: | WorkflowInducer | null; promoteAfterSuccesses?: number | null; store: MemoryStoreAdapter; tracer: Tracer; }
args.inducer?| WorkflowInducer | null
args.promoteAfterSuccesses?number | null
args.storeMemoryStoreAdapter
args.tracerTracer

Returns

ProceduralMemory

Methods

activate()

ts
activate(scope, context?): Promise<readonly Rule[]>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:334

Return the rules active under context. Rules without a condition are always active; the bundled predicate vocabulary supports the literals 'always', 'topic=<topic>', and 'tag=<tag>'. Anything outside that grammar is treated as always-active so callers do not silently lose rules.

Quarantined procedures are excluded (P1-4 / P2-2): an induced procedure must not drive actions until validated, so activation - which feeds the system prompt - never surfaces it.

Parameters

ParameterType
scopeSessionScope
contextRuleActivationContext

Returns

Promise&lt;readonly Rule[]&gt;


define()

ts
define(scope, input): Promise<Rule>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:192

Persist a rule. Returns the stored record.

Parameters

ParameterType
scopeSessionScope
inputRuleInput

Returns

Promise&lt;Rule&gt;


induce()

ts
induce(
   scope, 
   trajectory, 
opts?): Promise<Rule | null>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:235

Induce a reusable procedure (P2-2) from a successful agent trajectory and store it quarantined + provenance: 'induction' (P1-4). Returns the stored Rule, or null when the trajectory was unsuccessful / empty or the inducer produced nothing inducible.

Throws ProcedureInductionNotConfiguredError when no inducer was configured (createMemory({ procedureInduction: { provider } })).

Parameters

ParameterType
scopeSessionScope
trajectoryTrajectory
optsInduceOptions

Returns

Promise&lt;Rule | null&gt;


induceFromRun()

ts
induceFromRun(
   scope, 
   run, 
opts?): Promise<Rule | null>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:293

Convenience over induce: distil the Trajectory from a completed RunState (the agent's already-emitted run state) and induce a procedure. The success signal is status === 'completed'.

Parameters

ParameterType
scopeSessionScope
runRunState
optsInduceOptions

Returns

Promise&lt;Rule | null&gt;


list()

ts
list(scope): Promise<readonly Rule[]>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:315

List every active (non-deleted) rule for the supplied scope.

Parameters

ParameterType
scopeSessionScope

Returns

Promise&lt;readonly Rule[]&gt;


recordOutcome()

ts
recordOutcome(
   scope, 
   ruleId, 
   succeeded): Promise<{
  promoted: boolean;
  refused: boolean;
  successCount: number;
}>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:142

Record the outcome of one demonstrated reuse of a procedure (MCON-2 part 4). A success increments the rule's persistent successCount; when procedurePromotion.afterSuccesses is configured and a QUARANTINED procedure reaches the threshold it is promoted through validate - the injection gate still applies, so a flagged text refuses promotion (surfaced as refused: true) no matter how many successes accumulate. Failures are observed but not persisted (no negative counter yet).

Callers decide what "success" means - typically checkSuccessCriteria(...) over the procedure's stored successCriteria, or an operator's judgement.

Parameters

ParameterType
scopeSessionScope
ruleIdstring
succeededboolean

Returns

Promise<{ promoted: boolean; refused: boolean; successCount: number; }>

Stable


remove()

ts
remove(
   scope, 
   ruleId, 
reason?): Promise<void>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:302

Soft-delete a rule.

Parameters

ParameterType
scopeSessionScope
ruleIdstring
reason?string

Returns

Promise&lt;void&gt;


ts
search(
   scope, 
   query, 
opts?): Promise<readonly MemoryHit<Rule>[]>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:360

Runbook content search (D3): "find the procedure for this task" - lexical recall over rule text, as opposed to predicate activate. Returns whole validated procedures (the full Rule incl. steps / variables / success criteria) so a match can be followed file-style rather than re-synthesized from fragments. Quarantined (unvalidated induced) procedures are excluded - they must not drive actions - unless the inspector opts in via includeQuarantined.

Uses the storage adapter's FTS surface when available (procedural.search, the default @graphorin/store-sqlite adapter implements it via migration 028); otherwise degrades to an offline in-memory token-overlap scan over list, so custom adapters keep working without the index.

Parameters

ParameterType
scopeSessionScope
querystring
opts{ includeQuarantined?: boolean; topK?: number; }
opts.includeQuarantined?boolean
opts.topK?number

Returns

Promise<readonly MemoryHit&lt;Rule&gt;[]>


validate()

ts
validate(
   scope, 
   ruleId, 
   reason?, 
options?): Promise<void>;

Defined in: packages/memory/src/tiers/procedural-memory.ts:421

Promote a quarantined (induced) procedure into activate() (MCON-2). Mirrors SemanticMemory.validate: re-derives the injection verdict from the stored rule text and refuses promotion of an injection-flagged procedure unless an operator passes { force: true }. Induced procedures drive actions, so this gate matters most for them.

Parameters

ParameterType
scopeSessionScope
ruleIdstring
reason?string
options?{ force?: boolean; }
options.force?boolean

Returns

Promise&lt;void&gt;