github.com/GustyCube/membrane/pkg/ingestion
The ingestion package classifies, validates, and persists raw data as MemoryRecord instances. It coordinates the Classifier, PolicyEngine, and storage.Store.
You can call all ingestion methods through the top-level
Membrane facade without importing this package directly. Import pkg/ingestion only when constructing a Service independently.Service
Membrane.New wires this together automatically.
IngestEvent
MemoryRecord from a discrete event such as a user input, system alert, or error.
IngestEventRequest
Identifies the actor or system that produced the event. Used in provenance tracking.
Type of event. Examples:
user_input, error, system.Reference identifier for the source event within the host system.
Optional human-readable summary of the event.
When the event occurred. Defaults to
time.Now().UTC() when zero.Optional labels for categorisation and retrieval.
Visibility scope (e.g.,
user, project).Overrides the default sensitivity level when set.
IngestToolOutput
MemoryRecord with a populated ToolGraph from a tool invocation.
IngestToolOutputRequest
Identifies the actor or system that invoked the tool.
Name or identifier of the invoked tool.
Arguments passed to the tool.
Output produced by the tool.
IDs of tool nodes this output depends on, forming a tool graph.
When the tool was invoked. Defaults to
time.Now().UTC() when zero.Optional labels for categorisation.
Visibility scope.
Overrides the default sensitivity level when set.
IngestObservation
MemoryRecord from a structured subject-predicate-object observation. The resulting record has ValidityMode: global and RevisionPolicy: replace by default.
IngestObservationRequest
Identifies the actor or system that made the observation.
Entity the observation is about.
Relationship or property being observed.
Value or related entity being observed.
When the observation was made. Defaults to
time.Now().UTC() when zero.Optional labels.
Visibility scope.
Overrides the default sensitivity level when set.
IngestOutcome
TargetRecordID, sets EpisodicPayload.Outcome, appends a provenance source, and persists the update. Returns an error if the target record is not episodic.
IngestOutcomeRequest
Identifies the actor or system reporting the outcome.
ID of the existing episodic record to update.
Result of the episode. One of
success, failure, or partial.When the outcome was determined. Defaults to
time.Now().UTC() when zero.IngestWorkingState
MemoryRecord from a snapshot of the current task state. Working records are intended to be replaced (or discarded) when a task ends.
IngestWorkingStateRequest
Identifies the actor or system producing the working state.
Identifier for the current thread or session.
Current task state. One of
planning, executing, blocked, waiting, done.List of next planned actions.
Unresolved questions for the task.
Human-readable summary of the current context.
Constraints currently active for the task execution.
When the working state was captured. Defaults to
time.Now().UTC() when zero.Optional labels.
Visibility scope.
Overrides the default sensitivity level when set.
Default confidence by source type
ThePolicyEngine assigns an initial Confidence value based on source type:
| Source kind | Default confidence |
|---|---|
| Event | 0.8 |
| Tool output | 0.9 |
| Observation | 0.7 |
| Outcome | 0.85 |
| Working state | 1.0 |
Default half-life by memory type
ThePolicyEngine assigns a decay half-life based on the classified memory type:
| Memory type | Default half-life |
|---|---|
episodic | 1 hour (3 600 s) |
working | 1 day (86 400 s) |
semantic | 30 days (2 592 000 s) |
competence | 30 days (2 592 000 s) |
plan_graph | 30 days (2 592 000 s) |