Skip to content

Commit eb43e92

Browse files
committed
feat(personas): render a persona's trait paragraph on the full runtime without a learning layer
Signed-off-by: jddunn <[email protected]>
1 parent d6226fc commit eb43e92

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎docs/GMI.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ GMIs serve the full runtime's sessions, and, with `runtime: 'gmi'` (or [`gmi()`]
1212
|---|---|---|---|
1313
| Entry point | `AgentOS.create()`, or `new AgentOS()` and `initialize(config)`; then `processRequest()` | `agent({ runtime: 'gmi', ... }).session(id).send()` or `.stream()` | `agent({...}).session(id).send()` or `.stream()`; `agency({...})` |
1414
| Per-session state | A GMI from `GMIManager` | A GMI per session, over the session's message history held in process memory | A message history held in process memory |
15-
| Persona | A persona definition, named on every request by `selectedPersonaId`; its HEXACO traits reach the prompt only with a learning layer: the `learning` option, or a layer passed in `gmiManagerConfig.learningLayer` ([Learning](#learning)) | A persona built from the agent's options: the system prompt `agent()` sends, `personality` as HEXACO traits; with `learning` on, the personality section is a system prompt of its own | `instructions` and `personality`, written into the system prompt |
15+
| Persona | A persona definition, named on every request by `selectedPersonaId`; its HEXACO traits reach the prompt as the personality section, which a learning layer prepares each turn when one runs: the `learning` option, or a layer passed in `gmiManagerConfig.learningLayer` ([Learning](#learning)) | A persona built from the agent's options: the system prompt `agent()` sends, `personality` (else a soul's `hexaco`) as HEXACO traits; the personality section is a system prompt of its own | `instructions` and `personality`, written into the system prompt |
1616
| Sentiment tracking and metaprompts | Yes | With `cognition: 'full'` or a `CognitionConfig` that turns them on | No |
1717
| Long-term memory | A cognitive memory manager, when `gmiManagerConfig.cognitiveMemoryFactory` supplies one | A cognitive memory manager built from `memory`, one per agent; or a `memoryProvider` you pass in | A `memoryProvider` you pass in |
1818
| Guardrails, RAG, HITL, channels, emergent tools | Run by the runtime | Accepted without being applied, with a warning; `voice`, `avatar` and `channels` throw | `agent()` accepts them without applying them and logs a warning ([capability contract](https://github.com/framerslab/agentos/blob/master/src/api/runtime/capabilityContract.ts)); `agency()` applies HITL approvals and, on `hierarchical`, emergent specialists at the agency level, reports its guardrail ids as not enforced, adds no RAG context and wires no channels ([Agencies](./AGENCIES.md)) |
@@ -291,7 +291,7 @@ A field set to `null` reads as unset, as a config read from JSON or YAML writes
291291

292292
### The personality section
293293

294-
With the layer on, every GMI sends its persona's personality section as a system prompt of its own at priority 2, after the persona's base prompt: a string or a template prompt has priority 1, and the entries of a prompt given as a list keep their own priorities, so an entry above 2 comes after the section (the prompt engine sorts ascending and keeps the order of equals). The section is prepared once per user turn, before the first model call, and every model step of the turn sends the same text. The words are the ones `agent()` writes ([`personalityPrompt.ts`](https://github.com/framerslab/agentos/blob/master/src/cognition/substrate/personas/personalityPrompt.ts)): the heading `## Personality & Communication Style` and one directive for each HEXACO trait above 0.65 or below 0.35, in the order honesty, emotionality, extraversion, agreeableness, conscientiousness, openness. A persona whose traits all sit from 0.35 to 0.65 sends none. `gmi()` leaves the section out of the persona's base prompt, so the prompt holds it once; an agent built with `systemBlocks` gets it after its blocks.
294+
With the layer on, and with no layer for a persona that has traits, a GMI sends its persona's personality section as a system prompt of its own at priority 2, after the persona's base prompt: a string or a template prompt has priority 1, and the entries of a prompt given as a list keep their own priorities, so an entry above 2 comes after the section (the prompt engine sorts ascending and keeps the order of equals). The section is prepared once per user turn, before the first model call, and every model step of the turn sends the same text. The words are the ones `agent()` writes ([`personalityPrompt.ts`](https://github.com/framerslab/agentos/blob/master/src/cognition/substrate/personas/personalityPrompt.ts)): the heading `## Personality & Communication Style` and one directive for each HEXACO trait above 0.65 or below 0.35, in the order honesty, emotionality, extraversion, agreeableness, conscientiousness, openness. A persona whose traits all sit from 0.35 to 0.65 sends none. `gmi()` leaves the section out of the persona's base prompt, so the prompt holds it once; an agent built with `systemBlocks` gets it after its blocks.
295295

296296
A learner's turn in mode `on` or `frozen` renders the learner's trait row, which starts at the persona's authored traits and changes only through the operator's calls and the load rules below; a turn with no learner, a turn in mode `off`, a learner whose record does not verify and every turn while the learning store does not open render the authored traits ([The trait row and the ledger](#the-trait-row-and-the-ledger)). `GMI.setPersonalityTrait()`, and so `adapt_personality`, changes the GMI's copy of the persona and no prompt. A workflow seat's role overlay renders for that seat's session only and never sets honesty-humility or emotionality: an overlay value for either, under any of its spellings (`honestyHumility`, `honesty_humility`), is not rendered, and a warning names the persona and the trait. An overlay value written under an alias (`opennessToExperience`) is read as the trait's own, beside the persona's value under the canonical key.
297297

@@ -518,7 +518,7 @@ When the manager receives HEXACO `traits` (each from 0 to 1), every mechanism ex
518518
| Honesty | Agent-inference and reflection decay multipliers | − 0.15v, with floors of 0.5 and 0.4 |
519519
| Agreeableness | Emotion-regulation reappraisal rate | × (0.7 + 0.6v) |
520520

521-
Personality reaches the model separately on each path. `agent()` writes its `personality` traits into a "Personality & Communication Style" section of the system prompt, with distinct instructions for values above 0.65 and below 0.35. `agent({ runtime: 'gmi' })` puts the same section in its persona's base prompt and carries the traits as the persona's `personalityTraits`, which its memory manager scales the mechanisms with; nothing on that path changes them afterwards, because `gmi()` registers no `adapt_personality` tool and hands the caller no GMI to call `setPersonalityTrait()` on. With `learning` on it leaves the section out of the base prompt and sends it as a system prompt of its own on every turn ([Learning](#learning)). On the full runtime, persona definitions carry `personalityTraits`, which reach the prompt as that section only with a learning layer (the `learning` option, or a layer passed in `gmiManagerConfig.learningLayer`); `GMI.setPersonalityTrait()` changes one trait for one GMI, and the `adapt_personality` tool (with `emergentConfig.selfImprovement.enabled`) calls it for the GMI that runs the tool; no metaprompt changes traits, and a changed trait reaches no prompt: the section renders the learner's trait row or the persona's authored traits ([The personality section](#the-personality-section)).
521+
Personality reaches the model separately on each path. `agent()` writes its `personality` traits into a "Personality & Communication Style" section of the system prompt, with distinct instructions for values above 0.65 and below 0.35. `agent({ runtime: 'gmi' })` carries the traits as the persona's `personalityTraits`, which its memory manager scales the mechanisms with, and its GMI sends the same section as a system prompt of its own on every turn, outside the base prompt; nothing on that path changes them afterwards, because `gmi()` registers no `adapt_personality` tool and hands the caller no GMI to call `setPersonalityTrait()` on. With `learning` on the learner session prepares that section ([Learning](#learning)). On the full runtime, persona definitions carry `personalityTraits`, which reach the prompt as that section with or without a learning layer (the `learning` option, or a layer passed in `gmiManagerConfig.learningLayer`, prepares it each turn); `GMI.setPersonalityTrait()` changes one trait for one GMI, and the `adapt_personality` tool (with `emergentConfig.selfImprovement.enabled`) calls it for the GMI that runs the tool; no metaprompt changes traits, and a changed trait reaches no prompt: the section renders the learner's trait row or the persona's authored traits ([The personality section](#the-personality-section)).
522522

523523
### Retrieval
524524

‎docs/SOUL_FILES.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ The exceptions:
300300
- One-shot `generate()` and `stream()` on a GMI run the light profile, so they use the memory provider's recall, the wiki store's on a souled agent, even when sessions run with cognitive memory on.
301301
- A seat of a launched team uses neither memory hook (no recall from the provider, nothing stored with it) and is refused the memory tools, `read_memory_page` among them.
302302
- Hard limits are a block of prompt text a GMI renders from the persona, not a check that enforces them.
303-
- On the full runtime, the trait paragraph from the `hexaco:` scores reaches the prompt only with a learning layer ([GMI.md](./GMI.md#learning)).
303+
- On the full runtime, the trait paragraph from the `hexaco:` scores reaches the prompt with or without a learning layer; with one, the layer prepares it each turn ([GMI.md](./GMI.md#learning)).
304304

305305
## Loading Order at Agent Boot
306306

@@ -315,7 +315,7 @@ The exceptions:
315315

316316
The `hexaco:` block in SOUL.md frontmatter maps directly to AgentOS's existing
317317
[HEXACO personality model](./memory/HEXACO_PERSONALITY.md). The scores land in
318-
`personaDefinition.personalityTraits`. On the full runtime they are the GMI's traits; their trait paragraph reaches the prompt only with a learning layer ([GMI.md](./GMI.md#learning)):
318+
`personaDefinition.personalityTraits`. On the full runtime they are the GMI's traits, and their trait paragraph is part of its system prompt:
319319

320320
- [`AdaptPersonalityTool`](https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/AdaptPersonalityTool.ts): with `emergentConfig.selfImprovement.enabled`, changes a trait for the session's GMI within a per-session budget
321321
- [`PersonalityMutationStore`](https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/PersonalityMutationStore.ts): records those changes when a storage adapter is configured

‎src/cognition/substrate/GMIManager.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ export class GMIManager {
612612
* session opens, that session names a turn's scope ids by the session's own form, with no learner, and its recorder
613613
* and guard try the open; once one opens, every call reaches it. The GMI's memory manager goes to the learner
614614
* session, so the layer re-files its Brain, hydrates the learner's scopes into it and reaches it in `forgetUser`.
615-
* Without a layer the result is empty, and the GMI is built as before the layer existed.
615+
* Without a layer the GMI is given the persona's traits alone, when it has any, and renders their paragraph itself.
616616
*
617617
* @param effectivePersona - The persona the GMI is initialized with: the registry persona, overlay applied.
618618
* @param runtimeContext - The GMI's id, its session and the user it is created for.
@@ -626,11 +626,15 @@ export class GMIManager {
626626
memory?: ICognitiveMemoryManager,
627627
): Promise<Pick<GMIBaseConfig, 'learning' | 'personaTraits'>> {
628628
const layer = this.config.learningLayer;
629-
if (!layer || !source) return {};
630-
const authored = normalizeHexacoTraits(source.registryPersona.personalityTraits);
629+
const registryPersona = source?.registryPersona ?? effectivePersona;
630+
const authored = normalizeHexacoTraits(registryPersona.personalityTraits);
631631
// The registry traits as written: an alias the persona writes itself beside its canonical key is no patch.
632-
const overlay = traitOverlayPatch(source.registryPersona.personalityTraits, effectivePersona.personalityTraits);
632+
const overlay = source ? traitOverlayPatch(source.registryPersona.personalityTraits, effectivePersona.personalityTraits) : undefined;
633633
const personaTraits = { authored, ...(overlay ? { overlay } : {}) };
634+
if (!layer || !source) {
635+
// With no layer the GMI renders the persona's traits itself; a persona with none gets nothing, as before.
636+
return Object.keys(authored).length > 0 || overlay ? { personaTraits } : {};
637+
}
634638
const context: LearnerContext = {
635639
sessionId: runtimeContext.sessionId,
636640
personaId: source.registryPersona.id,

0 commit comments

Comments
 (0)