๐ Memory, Knowledge & Codebase Index
Overview
Oryn provides three complementary layers of context that persist beyond a single chat session. AI Memory lets you store personal preferences and project facts that are silently injected into every prompt. The Knowledge Base is a team-readable store of runbooks, architecture decisions, and post-mortems that the agent can browse. Codebase Indexing walks your workspace folder, chunks every source file, and embeds those chunks so you or the agent can search the codebase by meaning rather than just by text match.
How it works
AI Memory entries are saved in the browser's local storage and assembled into a short system block that is prepended to every prompt sent to the AI โ no server round-trip required. The Knowledge Base is persisted by the Workspace API as tagged document rows in Postgres (type = "knowledge") and exposed through a REST API the agent can query. Codebase indexing runs in the Gateway service: it walks the workspace folder, splits files into ~40-line chunks with a 10-line overlap, embeds each chunk using a local embedding model (or Ollama if configured), and writes the result to .oryn/codebase-index.json inside your project. Search queries are re-embedded at query time and ranked by cosine similarity against the stored chunk embeddings. A separate agent-side indexer (IndexingController / CodebaseIndexer) can also store chunks directly in Postgres for longer-term workspace-scoped search. Agent memory facts are durably stored per workspace in a Postgres table via the memory-mcp MCP server and are available to the agent as named key-value facts it can store, recall, list, or search across sessions.
What you can do
How to use it
- Open the Memory panel and review your memories
Click the brain icon or open the Memory panel from the sidebar. On first launch, three example entries are seeded (response style, indentation preferences, test framework). Review them and delete any that do not apply to you. - Add your own memory entries
Click '+ Add memory', choose a category (e.g. Preferences for code style, Project for repo-specific facts), type what the AI should always know, and click Save. The entry is stored locally and will appear in every future prompt. - Pin the most important entries
Click the pin icon on any entry to keep it at the top of the injected context. This is useful for non-negotiable rules like 'never use var in TypeScript'. - Open the Codebase Index panel
Open Codebase Search from the command palette or sidebar. The panel shows your current workspace folder and whether an index has been built yet. - Build the codebase index
Click 'Build Index'. Oryn walks every supported source file in your workspace (excluding node_modules, dist, .git, and similar), splits each file into overlapping 40-line chunks, embeds them, and saves the result to .oryn/codebase-index.json. A live elapsed-time counter shows progress. - Search your codebase semantically
Type a natural-language question such as 'how does authentication work' into the search box. Results appear automatically after a short debounce, ranked by semantic similarity with file path, line numbers, a relevance score, and a code preview. Click any result to jump directly to that location in the editor. - Use @codebase in chat
In the AI chat input, type @codebase followed by your question. Oryn pulls the highest-scoring chunks from the index into the prompt automatically, giving the agent immediate access to the relevant code without you needing to copy-paste anything. - Browse and add Knowledge Base entries
Open the Knowledge panel, click Refresh to load existing entries, and use the backend API (POST /api/v1/knowledge) or any connected admin tool to add runbooks, architecture decision records, or post-mortems that the whole team and agent can reference.