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
new ProceduralMemory(args): ProceduralMemory;Defined in: packages/memory/src/tiers/procedural-memory.ts:112
Parameters
| Parameter | Type |
|---|---|
args | { inducer?: | WorkflowInducer | null; promoteAfterSuccesses?: number | null; store: MemoryStoreAdapter; tracer: Tracer; } |
args.inducer? | | WorkflowInducer | null |
args.promoteAfterSuccesses? | number | null |
args.store | MemoryStoreAdapter |
args.tracer | Tracer |
Returns
ProceduralMemory
Methods
activate()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
context | RuleActivationContext |
Returns
Promise<readonly Rule[]>
define()
define(scope, input): Promise<Rule>;Defined in: packages/memory/src/tiers/procedural-memory.ts:192
Persist a rule. Returns the stored record.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
input | RuleInput |
Returns
Promise<Rule>
induce()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
trajectory | Trajectory |
opts | InduceOptions |
Returns
Promise<Rule | null>
induceFromRun()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
run | RunState |
opts | InduceOptions |
Returns
Promise<Rule | null>
list()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
Returns
Promise<readonly Rule[]>
recordOutcome()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
ruleId | string |
succeeded | boolean |
Returns
Promise<{ promoted: boolean; refused: boolean; successCount: number; }>
Stable
remove()
remove(
scope,
ruleId,
reason?): Promise<void>;Defined in: packages/memory/src/tiers/procedural-memory.ts:302
Soft-delete a rule.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
ruleId | string |
reason? | string |
Returns
Promise<void>
search()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
query | string |
opts | { includeQuarantined?: boolean; topK?: number; } |
opts.includeQuarantined? | boolean |
opts.topK? | number |
Returns
Promise<readonly MemoryHit<Rule>[]>
validate()
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
| Parameter | Type |
|---|---|
scope | SessionScope |
ruleId | string |
reason? | string |
options? | { force?: boolean; } |
options.force? | boolean |
Returns
Promise<void>