โ—† Oryn
Docs โ€บ User โ€บ Memory, Knowledge & Codebase Index

๐Ÿ“š Memory, Knowledge & Codebase Index

Give the AI a long-term memory, a shared knowledge base, and a searchable index of your code โ€” so it always has the right context.

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

AI Memory panelA local, per-user store of facts (preferences, identity, project context, tools, other) that are automatically added to every AI prompt.
Memory categoriesEntries are organised into five categories โ€” Identity, Preferences, Project, Tools, and Other โ€” and can be filtered in the panel.
Pin & prioritise memoriesPin any memory entry so it always appears at the top of the injected context block, regardless of recency.
Enable / disable memoryA single toggle in the Memory panel turns injection of all memories on or off globally without deleting any entries.
Agent long-term memory (memory-mcp)The AI agent can durably store and retrieve named facts per workspace via memory_store, memory_recall, memory_list, and memory_search MCP tools backed by Postgres.
Knowledge BaseA shared library of titled documents (runbooks, ADRs, post-mortems) stored in the backend and browsable from the Knowledge panel, filterable by text or tag.
Codebase indexingOne-click indexing of a workspace folder โ€” walks source files, chunks them with overlap, embeds each chunk, and saves the index to .oryn/codebase-index.json.
Semantic codebase searchQuery the index in plain language; results are ranked by cosine similarity and show file path, line range, relevance score, and a code preview.
@codebase chat mentionType @codebase followed by a question in the chat input to automatically retrieve and inject the most relevant code chunks into that prompt.
Embedding backend flexibilityThe indexer uses Ollama for embeddings when available and falls back to a built-in local embedding model, so indexing works fully offline.

How to use it

  1. 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.
  2. 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.
  3. 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'.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.

Example

You are working on a new feature and want the agent to respect your team's conventions without repeating yourself every session. Open the Memory panel and add: category = Preferences, text = "All API endpoints must return RFC 7807 problem+json on errors." Save it and pin it. Now open Codebase Search, click Build Index, and wait for indexing to complete (the panel shows something like "Indexed: 3 420 chunks ยท local ยท 8 241 ms"). In the chat box type: "@codebase where are HTTP error responses currently constructed?" Oryn re-embeds your query, ranks all chunks by cosine similarity, and injects the top matches โ€” say, ErrorHandlingMiddleware.cs lines 14-52 with score 0.847 โ€” directly into the prompt. The agent reads both your pinned memory rule and the actual middleware code, then replies with a precise, contextually correct answer about your codebase.

Admin notes

The codebase index is written to .oryn/codebase-index.json inside the workspace root. Add .oryn/ to your .gitignore if you do not want index files committed. The Gateway endpoints /api/v1/codebase/index and /api/v1/codebase/search require a valid Oryn license (RequireLicense middleware). The agent-side IndexingController (/api/v1/indexing/workspace) is served by the Agent API and stores chunks in the connected Postgres database; ensure the Agent API has a reachable Postgres instance with the pg_trgm extension available for the trigram index used by content search. The memory-mcp server reads its Postgres connection from the POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD environment variables. AI Memory entries are stored only in the desktop user's browser local storage (key: oryn.memory.entries) and are not synced across machines or users.

Related