Project aliases¶
A project alias tells a brain that two project= labels designate the same project. This page
explains the problem aliases solve, exactly where they act, the three MCP tools that manage them,
and the limits of the mechanism.
The problem¶
Every memory carries a project=<slug> tag in its source_description (see
tagging and scope). Over time one project ends up under several
slugs: a repository is renamed, an older client wrote MY_PROJECT where a newer one writes
my-project, or a desktop conversation picked a topic slug that differs from the repository name
used by a coding client.
Once read scoping is enabled, a search scoped to one slug drops the memories tagged with the other. An alias joins them again without touching the stored memories.
What an alias is¶
An alias is a row in the spongram_project_aliases table of one brain: alias -> project. The
project side is the canonical slug; the alias side is another label found on existing
memories.
| Side | Accepted form | Notes |
|---|---|---|
project (canonical) |
^[a-z0-9][a-z0-9._-]{0,63}$ |
Lower case only; this is the value clients pass as scope.project |
alias |
^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$ |
Case is kept and compared as written, so a legacy label such as MY_PROJECT can be an alias |
Rules enforced on every write:
- an alias cannot point to itself;
globalanddesktop-inboxare reserved catch-all labels: neither can be an alias or a target (case is ignored for this check);- the target cannot itself be an alias of another project;
- a label that already has aliases of its own cannot become an alias;
- a brain holds at most 200 aliases.
Setting an alias that already exists with a different target re-points it.
Read-time only¶
Aliases act when memories are read, in two places. No episode is ever rewritten: the tags stored in the graph stay as the clients wrote them, and removing an alias restores the previous behaviour.
Scoped search¶
When a search tool receives scope.project, the server resolves it before filtering:
- if the value is an alias, it is replaced by its canonical project;
- the aliases of that canonical project are attached to the scope;
- the read-scope filter keeps results tagged with the canonical project or with any of its
aliases, in addition to what it always keeps (
global, untagged memories, the active persona).
Searching with the canonical slug or with one of its lower-case aliases therefore returns the same
results. The response reports the resolved scope under _spongram.scope, with an aliases list
when there is one.
The resolution happens before the search cache key is computed. Two names of one project share the same cache entries, and changing a project's aliases yields a new key, so a result cached under the previous alias set is not reused.
Requires read scoping
The search side depends on SPONGRAM_READ_SCOPING_ENABLED. With read scoping off, no
scope argument is read and aliases have no effect on search.
Session continuity¶
GET /v1/graph/data/episodes?project=<slug> returns the most recent episodes of a project; the
Claude Code plugin calls it when a session starts. When the project has aliases, the route returns
the episodes of the canonical project and of all its aliases. Labels are compared whole in that
case: project=web never matches project=webapp.
Single-level resolution¶
Resolution never follows more than one link. The write rules above prevent chains from being created, and even if two concurrent writes created one, an alias of an alias would not be followed: the lookup maps a label to its direct target and stops.
Tools¶
The three tools are served by Spongram itself and appear in tools/list only when the feature is
enabled. There is no HTTP route for aliases: the table changes through the agent, at the user's
request or with their explicit agreement, because an alias changes what every later search sees.
See the tools reference for the complete MCP surface.
| Tool | Arguments | Result |
|---|---|---|
list_project_aliases |
none | aliases: canonical project to list of aliases. projects: the project= labels present in the brain with their episode count and canonical project (up to 200). untagged: number of episodes without a project= tag |
set_project_alias |
alias, project |
{"alias", "project", "previous"}; previous is the former target, or null for a new alias |
remove_project_alias |
alias |
{"alias", "removed"}; removed is false when the alias did not exist |
A rule violation in set_project_alias returns a JSON-RPC error -32602 whose message states the
rule. If the graph cannot be read, list_project_aliases still returns the alias table, without
projects and untagged.
{
"aliases": {"my-project": ["MY_PROJECT", "old-name"]},
"projects": [
{"project": "my-project", "episodes": 412, "canonical": "my-project"},
{"project": "old-name", "episodes": 57, "canonical": "my-project"}
],
"untagged": 3
}
With the Cloud control plane, on a brain whose access mode is enforce, list_project_aliases
requires the memory.read right and the two write tools require brain.configure.
What clients are told¶
With the feature enabled, the instructions returned by MCP initialize gain a paragraph: a search
with scope.project already includes that project's aliases, and aliases are changed only at the
user's request. When topic scoping is also enabled, clients that have no injected project context
(a desktop chat client, for example) are told to call list_project_aliases once per conversation
before inventing a new topic slug, and to reuse an existing canonical slug when one matches.
Caching¶
The alias table is cached per process for 60 seconds per brain. A write through the tools invalidates the cache of the process that handled it, so the change is visible to the next search on a single-process deployment.
Single process
The cache is local to a process. If the service ran as several processes or replicas, a process that did not handle the write would keep resolving with the previous table for up to 60 seconds.
When the table cannot be read¶
A search never fails because of aliases. If the alias table cannot be read, the scope is left as the client sent it: the filter applies to the requested slug alone, a warning is logged, and the search is never widened to other projects. The continuity route falls back in the same way to the requested slug.
Brain dumps¶
When the feature is enabled, a brain export (spongram-brain/v1) carries an optional
project_aliases key, a list of {"alias", "project"} objects. On import the aliases are written
in one transaction with the same rules as the tool: one invalid entry cancels the whole alias
import. A dump without the key imports as before, and a dump that contains only aliases, with no
episodes, is accepted. See ingestion for how the episodes of a dump are replayed.
Flag¶
| Variable | Code default | Server image | Desktop app |
|---|---|---|---|
SPONGRAM_PROJECT_ALIASES_ENABLED |
off | on | on |
The flag is on when its value is 1, true, yes or on. With it off, the table is never read,
the tools are not listed, and initialize, tools/list, searches and session continuity behave
exactly as they do without the feature. See feature flags for how
to override an image default.