Skip to content

Commit b3edd61

Browse files
committed
feat: expose cognitive mechanisms in agent() API + APA citations in README
Wire CognitiveMechanismsConfig through agent() -> memory initialization. Pass {} for all defaults, omit to disable (zero overhead). Add foundational APA citations for all 8 mechanisms.
1 parent b4716e5 commit b3edd61

3 files changed

Lines changed: 77 additions & 10 deletions

File tree

README.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,53 @@ Personality traits are set at agent creation and can be adapted within bounded l
425425

426426
8 neuroscience-backed mechanisms, all HEXACO personality-modulated:
427427

428-
| Mechanism | Effect |
429-
|-----------|--------|
430-
| Reconsolidation | Retrieved memories drift toward current mood |
431-
| Retrieval-Induced Forgetting | Retrieving one memory suppresses similar competitors |
432-
| Involuntary Recall | Random surfacing of old high-vividness memories |
433-
| Metacognitive FOK | Feeling-of-knowing scoring for tip-of-tongue states |
434-
| Temporal Gist Extraction | Old traces compressed to core assertions |
435-
| Schema Encoding | Novel input boosted, schema-matching encoded efficiently |
436-
| Source Confidence Decay | Agent inferences decay faster than observations |
437-
| Emotion Regulation | Reappraisal + suppression during consolidation |
428+
| Mechanism | Effect | Citation |
429+
|-----------|--------|----------|
430+
| Reconsolidation | Retrieved memories drift toward current mood | Nader, Schiller & LeDoux (2000). *Nature*, 406, 722-726 |
431+
| Retrieval-Induced Forgetting | Retrieving one memory suppresses similar competitors | Anderson, Bjork & Bjork (1994). *JEP: Learning*, 20, 1063-1087 |
432+
| Involuntary Recall | Random surfacing of old high-vividness memories | Berntsen (1996). *Applied Cognitive Psychology*, 10, 435-454 |
433+
| Metacognitive FOK | Feeling-of-knowing scoring for tip-of-tongue states | Hart (1965). *JEPG*, 56, 208-216 |
434+
| Temporal Gist Extraction | Old traces compressed to core assertions | Reyna & Brainerd (1995). *Developmental Review*, 15, 3-47 |
435+
| Schema Encoding | Novel input boosted, schema-matching encoded efficiently | Bartlett (1932). *Remembering*. Cambridge University Press |
436+
| Source Confidence Decay | Agent inferences decay faster than observations | Johnson, Hashtroudi & Lindsay (1993). *Psych. Bulletin*, 114, 3-28 |
437+
| Emotion Regulation | Reappraisal + suppression during consolidation | Gross (1998). *Review of General Psychology*, 2, 271-299 |
438+
439+
**HEXACO Personality Modulation** -- each mechanism's intensity is governed by one or more HEXACO traits:
440+
441+
| HEXACO Trait | Mechanisms Modulated | Effect |
442+
|--------------|---------------------|--------|
443+
| Emotionality | Reconsolidation | Higher emotionality increases mood-congruent drift rate |
444+
| Conscientiousness | Retrieval-Induced Forgetting | Higher conscientiousness strengthens suppression of irrelevant competitors |
445+
| Openness | Involuntary Recall, Schema Encoding | Higher openness increases involuntary recall probability and novelty boost |
446+
| Extraversion | Metacognitive FOK | Higher extraversion strengthens feeling-of-knowing confidence signals |
447+
| Honesty-Humility | Source Confidence Decay | Higher honesty increases skepticism of agent-inferred sources |
448+
| Agreeableness | Emotion Regulation | Higher agreeableness strengthens reappraisal during consolidation |
449+
450+
**Using cognitive mechanisms with `agent()`:**
451+
452+
```typescript
453+
import { agent } from '@framers/agentos';
454+
455+
const researcher = agent({
456+
provider: 'anthropic',
457+
instructions: 'You are a thorough research analyst.',
458+
personality: {
459+
openness: 0.9, // High openness -> more involuntary recall, stronger novelty bias
460+
conscientiousness: 0.85, // High conscientiousness -> stronger RIF suppression
461+
emotionality: 0.6, // Moderate -> moderate reconsolidation drift
462+
},
463+
memory: { enabled: true },
464+
cognitiveMechanisms: {
465+
// All 8 mechanisms enabled with defaults -- just pass {}
466+
// Or tune individual mechanisms:
467+
reconsolidation: { driftRate: 0.08 },
468+
involuntaryRecall: { probability: 0.12 },
469+
temporalGist: { ageThresholdDays: 30 },
470+
},
471+
});
472+
```
473+
474+
Pass `{}` for all defaults, or omit entirely to disable (zero overhead).
438475

439476
Memory is organized in a 4-tier hierarchy: `core/` (encoding, decay, working memory), `retrieval/` (composite scoring, graph, prospective), `pipeline/` (consolidation, observation, lifecycle), `io/` (ingestion, import/export).
440477

src/api/agent.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ export function agent(opts: AgentOptions): Agent {
195195
const sessions = new Map<string, Message[]>();
196196
const useMemory = opts.memory !== false;
197197

198+
/*
199+
* Cognitive mechanisms validation. When the caller provides a
200+
* `cognitiveMechanisms` config but has memory disabled, the mechanisms
201+
* cannot be wired (they depend on CognitiveMemoryManager which needs an
202+
* active memory subsystem). Log a warning and drop the config.
203+
*/
204+
if (opts.cognitiveMechanisms && !useMemory) {
205+
console.warn(
206+
'[AgentOS] cognitiveMechanisms config was provided but memory is disabled. ' +
207+
'Mechanisms require memory to be enabled (set `memory: true` or pass a MemoryConfig). ' +
208+
'The cognitiveMechanisms config will be ignored.',
209+
);
210+
}
211+
198212
/*
199213
* Resolve the effective usage ledger config. The top-level `usageLedger`
200214
* field is a backward-compat alias — if it is present we forward it to

src/api/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,22 @@ export interface BaseAgentConfig {
10411041
* @example `dependsOn: ['researcher']` — this agent waits for `researcher` to finish.
10421042
*/
10431043
dependsOn?: string[];
1044+
1045+
/**
1046+
* Cognitive mechanisms config — 8 neuroscience-backed memory mechanisms.
1047+
* All HEXACO-modulated (emotionality, conscientiousness, openness, etc.).
1048+
*
1049+
* - Pass `{}` for sensible defaults (all 8 mechanisms enabled).
1050+
* - Omit entirely to disable (zero overhead — no code paths execute).
1051+
* - Provide per-mechanism overrides to tune individual parameters.
1052+
*
1053+
* Requires `memory` to be enabled (`true` or a `MemoryConfig` object).
1054+
* If `cognitiveMechanisms` is set but `memory` is disabled, a warning is logged
1055+
* and the mechanisms config is ignored.
1056+
*
1057+
* @see {@link https://docs.agentos.sh/memory/cognitive-mechanisms | Cognitive Mechanisms Docs}
1058+
*/
1059+
cognitiveMechanisms?: import('../memory/mechanisms/types.js').CognitiveMechanismsConfig;
10441060
}
10451061

10461062
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)