The Storage Layer handles persistence of concepts, theories, and audit logs. It provides a uniform interface through the StorageAdapter, with pluggable backends for disk, memory, or custom storage systems.
Specification: DS(/storage/adapter) · DS(/storage/persistence)
By default, AGISystem2 stores all data in a .AGISystem2/ directory in the working directory:
.AGISystem2/
├── data/
│ ├── concepts/ # Binary concept data
│ │ ├── Dog.bin
│ │ ├── Cat.bin
│ │ └── Animal.bin
│ ├── index.json # Concept name index
│ └── audit/ # Operation logs
│ └── 2024-01-15.log
└── theories/
├── base.sys2dsl # Optional base theory
├── medical.sys2dsl # Named theory files
└── legal.sys2dsl
The StorageAdapter provides a uniform interface for storage operations:
| Method | Description |
|---|---|
saveConcept(name, data) | Persist concept to storage |
loadConcept(name) | Retrieve concept from storage |
deleteConcept(name) | Remove concept from storage |
listConcepts() | List all stored concept names |
saveTheory(name, facts) | Save theory to file |
loadTheory(name) | Load theory from file |
appendAudit(entry) | Append to audit log |
Stores concepts as binary files and theories as text. Suitable for persistent, file-based workflows.
In-memory storage for testing and ephemeral sessions. Data is lost when the process exits.
Implement the StorageAdapter interface to connect to databases, cloud storage, or other systems.
Efficient storage for concept vectors. Contains: header, vector data, metadata.
Human-readable text format. One fact per line, comments start with #:
# Medical knowledge base ASSERT Aspirin IS_A Drug ASSERT Aspirin REDUCES Inflammation ASSERT Ibuprofen IS_A Drug