Buffaly Logo Buffaly
How-to

How to use session-local memory

Keep a verified object, shorthand or relationship searchable later in the same conversation. The optional BuffalyNLMemory package stores typed session ontology in session artifacts and restores it into that session's runtime.

Choose session scope deliberately

Use session-local memory for a discovered file owner, an environment alias, a confirmed root cause or a relationship that will prevent repeated investigation. Keep evidence dumps and long logs in Scratch. Use permanent ontology memory when the user wants a fact remembered across sessions, and context guidance for an explicit standing instruction.

“Temporary” means scoped to the session. It does not mean RAM-only, automatically expiring or unavailable after a runtime rebuild. It is also not shared permanent project memory. See Memory and skills for the storage decision guide.

Install the package and check activation

  1. Search the target runtime for BuffalyNLMemorySkill and inspect ToRememberSomethingTemporarilySkill. Discovery alone is not a complete installed-package inventory.
  2. If package inspection confirms it is not installed, use the configured package directory to select package type Skill, package ID BuffalyNLMemory. Preview the actual source, compatibility, replacement and restart requirements before an authorized install. Use a source that offers that package; do not guess a download URL or overwrite a DLL manually.
  3. Inspect the installation receipt and active project include. The package provides its index, action declarations, prompt and Buffaly.NLMemory assembly reference. Its BuffalyNLMemoryRuntimeMemoryService has session scope and restores session artifacts during runtime initialization.
  4. Check that the expected action signatures are inspectable in the intended runtime. A receipt with PendingRestart or ActiveNow=false does not prove activation. Follow the normal approved activation workflow rather than restarting a running environment as a lookup step.

A package receipt on one machine proves that installation's package identity, not that every Buffaly deployment includes it. Repository maintenance scripts that replace an operator's local skill folder are not the package-managed installation procedure.

Remember a verified session fact

Ask: “Remember the file owner we just verified for this session. Use an existing ontology base, preserve the exact path and relationship, and show the saved prototype and indexing result.” Supply or verify the actual values; do not save a hypothesis as a confirmed root cause.

  1. Use ToRememberSomethingTemporarilySkill to select the appropriate existing base and one compact object or relationship. Search existing permanent and session definitions before creating a duplicate.
  2. Inspect the base's schema. Prepare exactly one complete prototype definition with a stable name and specific semantic entity phrase. Do not add unrelated top-level code, project includes or an invented base.
  3. Validate the block with ToValidateRuntimePrototypeDefinition(prototypeDefinition). This checks the proposed definition before interpretation; it is not the memory write.
  4. When the memory write is authorized, use ToTryInterpretRuntimePrototypeDefinition(prototypeDefinition) for the structured result. The alternative ToInterpretRuntimePrototypeDefinition is the throwing/text path. Both use the package's persistence owner rather than merely adding unpersisted runtime state.
  5. Inspect the result, the current prototype and artifacts/nl-memory/SessionMemory.pts in this session. Confirm the exact values and discovery receipt before saying it can be retrieved later.

Inspect and retrieve what was saved

  • ToGetPrototypeDetails is the preferred exact inspection when it can see the prototype. The package also provides ToGetRuntimePrototypeDetails(prototypeName).
  • ToDumpRuntimeMemories() reports the active runtime memory store. It is not a dump of every permanent ontology file or every other session.
  • ToSearchRuntimeMemories(filterPrototypeName) takes a prototype used as a categorization filter. It is not a free-text semantic query.
  • Use ToSearchCandidateEntities for semantic entity discovery, inspect the result's scope and use its exact canonical identity. Read the source artifact for persistence evidence.

Read the whole write result

The structured write returns Success, ErrorType, Reason, Message, prototype/base names, Retryable and ResultText. Read the binding and tag diagnostics in ResultText as well as the top-level status.

ResultMeaning and next check
Validation or parse failureInspect the exact reason and fix the single proposed definition. Do not change the installed base or coerce an invalid field.
MemorySemanticIndexPending / SavedButIndexingIncompleteThe source was saved, but indexing is incomplete. Preserve the receipt and inspect the artifact before retrying. Do not report retrieval success.
Interpreted with binding diagnosticsRuntime interpretation is not the same as successful semantic binding. Read BINDINGS, BINDING_FAILED and tag results, then verify the intended entity search.

A Retryable value does not mean blindly repeat a write. First determine whether source was already committed, which owner failed and whether an authorized correction is needed. Context memory uses a different receipt, SavedIndexPending; do not mix the two contracts.

Persistence and restoration

Entity definitions are persisted in artifacts/nl-memory/SessionMemory.pts. The session-scoped service restores them during runtime initialization. Session actions have a separate owner, artifacts/online-action-critic/SessionActions.pts; they are not entity memory.

ToRestoreRuntimeMemoriesFromSessionArtifacts() explicitly restores both stores into the current runtime. It changes runtime state and is not a routine read-only inspection. On an authorized disposable session, verify a saved entity before and after normal runtime reconstruction, then check that it still has the same identity and values. Use a test session rather than disrupting active work for this check.

Reuse a self-contained foreign definition

Search results can include foreign candidates with an exact ownerScope such as session:<session-key> and a PrototypeName. An unavailable foreign result is not locally callable until a supported copy or borrow succeeds.

  • Entities: use ToBorrowSessionEntity(ownerScope, prototypeName), or ToKeepSessionPrototype with kind="Entity". Inspect the returned locally persisted definition.
  • Actions in RunAction mode: use ToKeepSessionPrototype with kind="Action", inspect the exact signature, then invoke separately with ToRunAction.
  • Actions in loader-based mode: ToBorrowSessionAction also registers a tool. RunAction mode intentionally rejects that loader-changing path.

The package supports self-contained definitions, not automatic dependency imports. Ownership collisions and missing dependencies fail. Copying persists local source but does not execute an action, prove its target is still correct or expand the user's authorization. See Tools and action loading for exact invocation arguments.

Correct the owned definition without creating a duplicate

Inspect the runtime prototype and full persisted definition. Preserve unrelated properties and update that same session-owned name through validation and the structured interpretation path. The normal authoring checks reject replacing a prototype that is not owned by the target artifact. Reread the artifact and repeat the relevant category and entity lookup.

There is no universal forget operation across session entities, learned actions, permanent facts and context guidance. Context retraction does not erase session entities, and an action-critic reset is not an entity-memory reset. Identify the exact artifact and owning maintenance operation before an authorized retirement; do not delete other stores or claim previous messages were erased.

Verify the intended result

  1. Confirm the package, active action signatures and correct session scope.
  2. After an authorized write, inspect the exact source definition, runtime values and complete binding/index result.
  3. Use a type filter for category lookup and a semantic query for entity discovery; confirm the returned canonical name and scope.
  4. For persistence testing, use an authorized test runtime and compare the same values after reconstruction. Keep pending-index or restore failures visible rather than describing a write as a verified restore.
Memory and skills Semantic binding and maintenance Standing context guidance Plan, Scratch and Tasks