Release 0.6.0
A minor release. Property indexes grow up: label-less indexes, indexes over array elements
(each), unique indexes, exact index reads and counts from an index, on a layout that takes a
fraction of the memory. The graph itself takes less memory (smaller id and label indexes, nested
objects stored as shapes, dedup for every value type, a smaller embedding model in memory). The
servers get their own building blocks: the MCP endpoint becomes the crate graphersal-mcp
(shorter tool descriptions, a compact schema summary, MCP over a byte stream, per-connection
profiles) and the dev server's hosting core the new crate graphersal-serve; read-only serving
gets a reader pool. A series of store, dev-server and playground fixes lands as well.
It changes some public types (property index labels, transforms, advisor actions) and what the
MCP tool get_schema answers by default: read "Upgrading from 0.5.2" first. Snapshot and journal
formats are unchanged and no store needs an upgrade step; a store that uses one of the new index
forms opens read-only in 0.5.x, and one with a dedup rule of min_bytes: 0 is reported as
damaged by 0.5.2 and older.
Upgrading from 0.5.2
Stores. Stores, snapshots, journals and backups of 0.5.x open unchanged, with no upgrade step. What 0.6.0 writes can stop an older version from using a store:
- A new catalog kind 6
property_index_ext(DefinitionKind::PROPERTY_INDEX_EXT, CRITICAL) holds the new index forms (label-less,each, unique); once a store has one, Graphersal 0.5.x opens it read-only. Plain per-label indexes stay kind 2. Index names are one namespace across both kinds. - A
dedupcompression rule withmin_bytes: 0(the extendeddedup, below) makes Graphersal 0.5.2 and older report the store as damaged. There is no format marker for it: users upgrade, older versions need not open newer stores.
Rust API (breaking).
PropertyIndexDefinition::label()returnsOption<&str>;PropertyIndexInfo.labelisOption<String>andPropertyIndexInfo::newtakesOption<&str>.GraphStorage::vertices_by_property_index,edges_by_property_index,vertices_by_transformed_property_indexandedges_by_transformed_property_indextakelabel: Option<&str>(None= the label-less index).RecommendedAction::CreateIndex.labelandRecommendation.labelareOption<String>; the advice JSON and the memory report's index JSON show"label": nullfor a label-less index.- The struct variants of
RecommendedAction(CreateIndex,DropIndex,AddCompression,DropCompression) are#[non_exhaustive]: patterns outside the crate need.., and the variants cannot be built outside it.RecommendedAction::CreateIndexgainstransform. PropertyIndexTransformgainsEachandChain, andPropertyIndexTransform::KNOWN_NAMESholds two names. A transform chain is an array in the payload, the session JSON, the DSL and Python. Indexes witheachare kind 6 even with a label.StoreFailuregainedFilesInUsein the middle of its variants: code that casts the enum to a number sees shifted discriminants.- The Rust
from/toofadd_etakeimpl Into<EndpointArgs>instead ofimpl Into<ArgStrings>(neither type is nameable outside the crate; every argument type that compiled still does, see "Fixed"). graphersal-session(internal):Session::set_cancel_reset_by_hostis removed; every cancellable run of the dev server has a token of its own.
Behaviour.
create_indexwithout a label no longer fails: it creates a label-less index.- The MCP tools
get_schemaandinfer_schemaanswer a compact text summary by default, without the stored schema's descriptions. A client that parses the default answer as JSON must passformat: "json"; one that needs the descriptions passesdescriptions: trueor reads the resourcegraphersal://schema-summary. - The MCP tool descriptions are the short ones (the long texts of 0.5.2 are gone), and a saved
query offered as a tool (
--mcp-query-tools) lists the paging parametersoffset,max_rowsandmax_itemsonly withsaved_query_tools.paging_params: truein--mcp-config; a call may still pass them. graphersal store repairreportsall data keptinstead ofnothing lost. Scripts that matchednothing lostshould check the exit code instead (0: no data lost) or matchok: all data kept.
Property indexes
- Property indexes take far less memory. Each indexed value is held once with its elements as
compact slot lists: a low-cardinality index drops from about 48 to about 4 bytes per entry
(field graph: an edge
_ownerindex 28.2 -> 2.4 MB; a synthetic 1M-entry index over 500 values 48 -> 4 MB); building one is 2-8x faster, lookups and maintenance equal or faster. Near-unique keys cost as before. No API or format change. - Label-less property indexes.
g.create_index(#{key: "name"})(nolabel) indexes every vertex (or, withelement: "edge", every edge) whatever its labels, unlabeled ones included.g.v().has("name", x)andg.e().has("_owner", o)without a label now read it instead of scanning (field graph: an edge owner lookup 46 ms -> 0.09 ms); a labelled source reads it when it is cheaper than its per-label indexes and checks the labels..profile()shows[index: vertex name, any label]. GQLMATCH (n {name: $x})uses it too. RustPropertyIndexDefinition::label_less, Pythongraph.create_index(None, "name"), session/HTTP withlabelabsent ornull, MCPcreate_indexwithoutlabel, playground "any label" (Property Indexes). - Array indexes: the
eachtransform.g.create_index(#{key: "_owners", transform: "each"})holds one entry per array element, sog.v().has("_owners", __.unfold().is(o))reads the index (field graph: 105 ms -> 5-13 ms);transform: ["each", "to_lower"]serves__.unfold().to_lower().is(..). A whole-valuehas(k, x)can use it too (the value is re-checked)..profile()shows[index: vertex _owners each, any label]. NewPropertyIndexTransform::Each/ChainandPropertyIndexTransformChain; the advisor recommendseachfor keys holding arrays. - Unique indexes.
g.create_index(#{label: "User", key: "email", unique: true})refuses a write that would give a second element the same value (per label; label-less = over all vertices or edges; withtransform: "to_lower"case-insensitive). The check is immediate at each write, so swapping two values needs an intermediate one;nulland values the index does not hold are outside uniqueness. Creating one over existing duplicates is refused with up to 10 of them and a query listing all. A store holding duplicates under a unique index (written by an older version) still opens: the index is not served, listed with the reason, and the journal recordsindex.unique_duplicates. NewGraphError::UniqueViolation,DefinitionError::UniqueIndexDuplicates,GraphStorage::unique_index_duplicates; Pythonunique=True; playground checkbox. Overhead: +1.5-4 % per insert over a plain index. - Exact index reads skip the re-check. In a reading query, a condition a property index answers
exactly (a string, boolean, uuid or temporal value,
P.eqorP.within; whole-value,eachunder__.unfold().is(..),to_lowerand["each","to_lower"]while the index skipped nothing) is no longer re-checked on each candidate: thehasstep leaves the plan, andcount()over one such point is answered from the index. Field graph: an owner lookup.id()21-27 ms -> 1-2 ms,.count()-> microseconds..profile()shows, exactin the index marker. Results are unchanged; writing queries, numbers, ranges and supersets keep the re-check. NewStorageCapabilities::exact_property_index_lookups(EXPERIMENTAL trait; a host storage claims it only when its lookups return exactly the matching elements);&Gand a sharedArc<TraversalGraph>forward it. - Counts from an index.
g.v().has(k, "x").count()served by an exact index (label-less, or the single label's) is answered from the index without visiting elements;.profile()shows[count from index]. New trait methodGraphStorage::count_by_property_index(defaultOk(None)). - Advisor: recommends label-less indexes for scans without one label and hints when a key is
indexed both per label and label-less.
help()of a timed-out unlabeled filter namesg.create_index(#{key: ..}). - Fixed: a
to_lowerindex no longer answershas(k, __.to_lower().is(P.eq(())))(null) with no rows where the scan finds them.
Memory
- Smaller id and label indexes. The label index keeps handles plus one position per slot, the id index a slot and a hash: on a 534k-vertex / 2.3M-edge graph 157 -> 81 MB, the whole graph 1.82 -> 1.64 GB.
- Nested objects are stored as shapes, also straight from a snapshot load, like top-level maps.
- Embedding models take less memory: a compact tokenizer (931 -> 514 MiB for the same vectors), streaming model load, bounded slot growth after a load (no doubling at the first insert) (#24).
- The memory report attributes the whole process memory (graph, models, script engine, Stores, session, MCP, AI Chat); the playground and the REPL show a process memory bar.
- The memory report needs less transient memory: its per-row distinct-string sketch stays a
small exact list up to 32 distinct texts (
--graph large: peak 478 -> 408 MB); distinct counts up to 32 are exact.
Compression rules
dedupcodes top-level values of every type, with an advisor pass for repeated values; compression rules are applied in bulk (one unit, one commit, one walk), several advisor recommendations at once, and a snapshot load codes rows straight into the dictionaries (Compressed Properties).g.drop_compressions([names]): several rules dropped in one commit and one walk over the data, likeg.define_compressions. AlsoGraphStorage::remove_definitions(with a default),GraphTraversalSource::remove_definitions,AnyGraph::remove_definitions,POST /api/compression/drop-many, Pythongraph.drop_compressions(names).- Catalog ▸ Compression in the playground handles many rules. The table no longer scrolls sideways, sorts by any column and groups the rules by codec or label with each group's total; a checkbox per rule and group and Drop selected drop them in one commit.
- Advice to write a snapshot after changing compression rules. Until a snapshot holds them, every open re-encodes their labels, with a higher memory peak (74 rules: 2.2-2.9 GiB against 2.0 GiB). The Optimize panel shows a note with Write a snapshot now; the book pages Optimize, Compressed Properties and the FAQ say so.
- A store whose compression rules are only in the WAL opens much faster. An open walked the
data once per rule, then once more per rule at its end. Now rule changes in a row, even over many
commits, take one walk, and a dictionary just filled by it is not rebuilt: 74
deduprules on a real graph of 2.8 million elements opened in 8.5-10.5 s instead of 26.7-28.7 s, about as fast as from a snapshot. A repair walks the same way,TraversalGraph::replayonce per change set, andapply_change_setonce per run of rule changes; a mix of drops and new rules inapply_recommendationstakes two walks. Dictionaries that grew are rebuilt in one walk as well, also at the end of a commit and inshrink_to_fit. NewPersistentStorage::begin_replay/finish_replay(defaults: nothing): between themPersistentStorage::replaywalks once over the rule changes of many change sets.
MCP and the servers
- The MCP endpoint is its own crate,
graphersal-mcp(internal, EXPERIMENTAL), configured with the new--mcp-configfile;graphersal mcp-costshows what a configuration costs in context, and the resourcegraphersal://gql-reference(the whole GQL subset) is listed by default (Dev Server and MCP). - One set of short tool descriptions. About 6.7K tokens of context read-write and 4.6K
read-only (12.6K / 10.0K before). In A/B tests with Claude Code and Sonnet on 48 read and write
tasks the accuracy was the same, with a third of the failed calls and 19-27K fewer input tokens
per task. The
gqltext nameselement_id(n),labels/type, anchoring of variable-length patterns and, on writable servers, the write clauses; thequerytext the write steps and that a traversal before the last statement needs a terminal; the AI Chat prompt carries the GQL reference. Saved-query tools use the query's own description and list paging parameters only withsaved_query_tools.paging_params: true.--mcp-configaccepts"descriptions": "short"(it changes nothing) and refuses any other style. - Schema summary.
get_schemaandinfer_schemaanswer a compact text map of the graph by default: labels with counts, keys with types and how often they occur, edge from->to label pairs, indexes and the schema mode (field graph: 24k chars, where the JSON did not fit the answer limit at all).labelsdetails some labels;format: "json"returns the JSON as before. A/B with Sonnet on 16 schema tasks: 48/48 correct vs 46/48 with the JSON, half the calls and half the time. Resources mirror it:graphersal://schema-summary(text, new) andgraphersal://schema(JSON), both listed by default. RustGraphTraversalSource::schema_summary/AnyGraph::schema_summarywithgraphersal::schema::{SchemaSummary, SchemaSummaryRequest}; REPL/schema [label ...]; the AI Chat prompt carries the summary. - The schema summary leaves out the stored schema's descriptions by default
(#34): 24,182 -> 15,459 characters on a
real knowledge graph (-36 %).
descriptions: trueor the resourcegraphersal://schema-summarygive the full summary. A/B on 16 schema tasks: billed cost -13 %, input tokens -9 %, accuracy within noise (46/48 vs 48/48). - MCP over a byte stream. Besides HTTP,
graphersal-mcpserves MCP over any reader and writer:Connection(one MCP session with its own host) andserve_lines(the MCP stdio framing, newline-delimited JSON-RPC). On stream connections the server sendsnotifications/tools/list_changed(when saved queries are tools) andnotifications/progressheartbeats for tool calls that carry aprogressToken;Mcp::check_tools_changedlets a host trigger the notice. Cancellation works the same over HTTP and streams. The dev server's HTTP MCP endpoint is unchanged (no SSE). - Per-connection profiles. A
Profile(anMcpConfig, read-only, an optionalAccessPolicythe engine enforces, an answer limit) is chosen by the host for each connection; the session's writing tools follow the policy too. A host per connection, and an identity carried to the session jobs (ClientRef::identity). - Bound saved-query parameters.
Profile::with_bound_paramslets a host fix saved-query parameters per connection or HTTP request (for example the project it serves): a bound parameter disappears from the saved-query tools' input schemas, and every call of a saved query that declares it runs with the bound value, whatever the client sent. - Two new
--mcp-configkeys.saved_query_tools.write_note("default","none"or your own text with{effects}) sets the note at the end of a writing saved query's tool description;server_titlesetsserverInfo.titleininitialize(until now always "Graphersal dev server"). - A served graph shuts down cleanly.
graphersal_serve::start_job_tickerreturns aJobTicker(stop()), neither the ticker nor the job workers keep the context alive, andContext::background_runs()reports scheduled-job runs still in progress;Context::callandcall_falliblereturnServeError(HTTP answers unchanged). - Read-only serving has a reader pool: stateless MCP session ids, per-client limits, parallel readers (Read-only serving mode).
- MCP usage statistics in memory:
/api/mcp/stats, a playground dialog and the opt-in toolusage_statistics. - A self-contained knowledge-base image from prebuilt binaries, and
--allowed-host. - New crate
graphersal-serve(internal, EXPERIMENTAL): the hosting core of the dev server (session thread and job queue, job workers, the run registry, the playground HTTP API as an HTTP-library-free boundary, Host/Origin/loopback checks, the embedded UI behind the featureui-assets, thegraphersal-mcpglue behind the featuremcp; no default features).graphersal --serverbehaves as before (flags, HTTP API, MCP endpoint). Its extension points: a graph resolver (default: one graph), a run observer with a cancel handle, a request filter (it runs after the always-on Host/Origin checks), extra routes for unknown/api/paths, lifecycle and activity hooks, an executor policy (JobQueue), one MCP endpoint shared by several contexts with a profile per context (Context::mcp_connection), and the request filter's identity reaching MCP runs. AServertype answers the health probes and the loading/stopping 503s before the graph is loaded. graphersal-mcpandgraphersal-servehave no stability guarantees during 0.x: a dependent pins their exact versions (Releases and Versioning). Their errors follow the crate rule for shared state:serve_linesreturnsResult<(), McpError>,Context::mcp_connectionand the run registry's methods returnResult, and a session's setup error keeps the host's error as its source (ServeError::Setup).- A panicking session job of the dev server is logged through
tracing(targetgraphersal::server) instead of awarning:line on stderr; an unreadable store space usage answers 500 instead of ending the server, and a refused job-ticker time zone is an error.--ui-diris documented as an overlay over the embedded UI (only the files to override).
Dev server and playground
- A running scheduled job no longer holds up the dev server
(#26). Requests are answered while a
backup, a checkpoint or a reading query job runs;
GET /api/jobssaysrunning, and the jobs dialog shows a running badge. While a user's job runs, Store-menu operations on the files answer 409. New ingraphersal::jobs:Scheduler::start_due/start_now/finish/running/set_time_zone,JobRun,JobFinished,Job::with_group,JobInfo::running,JobError::Running. - The Scheduled jobs dialog lists one wrapping block per job instead of a table that scrolled sideways. The AI Chat shows a thinking timer, and its Markdown export holds the answers only.
Fixed
-
A Stop hits the right query (#30, #31). A shared, reused cancel token lost a cancel or stopped the wrong work: on the read-write server a Stop before a query reached the session thread was reset by the query (or stopped another page's work), and the drain of the read-only serving mode cancelled worker tokens that an AI Chat query does not check. Every query, layout slice, MCP query and AI Chat tool call now registers a token of its own under its client: a Stop cancels the page's run (or all its runs), MCP
notifications/cancelledthe client's own request, the graceful stop every run, never another client's run. Store views and rollbacks wait for running queries instead of cancelling them. -
Read-only serving: a Stop just before a query starts is no longer lost (#29).
POST /api/cancelansweredcancelled: trueand the query still ran to the end; a graceful stop past its drain timeout had the same gap. -
A backup or a verification beside a rollback no longer freezes an undamaged store (#27). They wait while a rollback or an attic change moves files; a rollback, attic restore or attic remove is refused with the new cause
StoreFailure::FilesInUsewhile files are being read. -
A fork or a packed export beside a rollback no longer fails with an I/O error or calls a manifest corrupt (#28).
Store::fork,Store::attic_forkandStore::export_packedhold the same pin as a backup: they wait while files move; while they run, a rollback, an attic restore or remove (FilesInUse) and a prune (BackupRunning) are refused, a slow export writer included. -
Playground: "Download current state (.gsnap)" no longer drops embedding models silently (#23). It asks, with the models' sizes;
GET /api/export?format=gsnapcarries them unless&models=without. -
Saving a graph no longer loses its embedding models.
g.export_snapshot,AnyGraph::write_snapshot, Pythongraph.saveand the dev server's "Save to file" carry the models the graph serves; before, "Save to file" over a--graph x.gsnapdestroyed them in the file. These writes replace the file only when finished, so the path may be the file the graph was loaded from. New:AnyGraph::write_snapshot_with,persist::write_graph_snapshot,SnapshotInfo::blobs_not_carried. -
A snapshot that reuses segment files of an older snapshot downloads with its models. A checkpoint references the unchanged segment files of an earlier snapshot instead of copying them. Exporting such a snapshot WITH the store's embedding models failed with
I/O error while reading a snapshot segment: No such file or directory, while the same snapshot exported without models, and snapshots that hold all their files, worked. This hit the Store menu's download (the dev server answered404),graphersal store exportwithout--without-models, PythonStore.export_packedandStore::export_packed(_with)in Rust. Nothing in the store was wrong, and no broken.gsnapwas ever written: the export stopped before its first byte. Backups (directory, increment, ZIP), forks and repairs were not affected. The dev server now answers a failed download with404only when the snapshot does not exist,422when the store refuses it (damage, a missing or damaged model) and500when a file cannot be read. -
addE().from(v)/.to(v)take a vertex (TinkerPop'sfrom(Vertex)/to(Vertex)). In Rhai and Python a vertex value (anext()result, a PythonVertexparameter, an edge'sout_v/in_v) failed with "expected vertex or vertex id, got null"; in Rust a vertex was read as a name, so a step label or side-effect key equal to its id won, and an edge value connected the vertex of the edge's id. Now a vertex is that vertex by its id; an edge value is an error. Rust:from/totakeimpl Into<EndpointArgs>instead ofimpl Into<ArgStrings>(neither type is nameable outside the crate; every argument type that compiled still does, plusVertexValue,&VertexRefandVec<ElementProperty>). -
An upgraded store whose newest WAL segment holds only a checkpoint record opens and takes commits again. A checkpoint taken while a store is open starts a new WAL segment named by the next commit and writes its checkpoint record there (a mark set afterwards adds its record too). After
graphersal store upgradeof a store of format version 3 (Graphersal 0.2.x to 0.4.x) that segment is of the older file format, and the first write after the upgrade refused the whole store as damaged:Corrupt …/wal/<N>.wal at byte 64: it starts at commit N, which is not committed yet. This hit:- opening the upgraded store;
- a commit to the closed store, such as
graphersal embed-model import <repo> --into <store>, which an upgraded store needs when its schema names a model it does not keep yet (0.4.x served such models through--embedder); - the upgrade of a 0.4.x store with models under
models/: its migration commit failed, and an in-place upgrade left the store half converted (GRAPHalready in the new version, theINTENTandmodels/still there), so neither an open nor a second upgrade worked.
Nothing was lost:
store verifyfound no damage, andstore repairbuilt a complete copy. Now such a segment is rewritten in the current format with its checkpoint and mark records kept, and the commit follows them. A store that is already stuck needs no manual step: with this release the open, the import or the repeatedstore upgrade --in-placecompletes. A store repaired with 0.5.x as a workaround is a complete store as well; only its history before the repaired commit and its marks stayed in the original (Store Format Versions, format spec 15.1). -
store repairsays what a repair never carries. A repair writes the readable state as one snapshot of a new store; the commits before it (rollback, views of past states, the attic), the marks and the store id stay in the store it was built from. The report used to saynothing lostright next tomark not carried. It now readsall data keptand names the rest in one line, also when no data is lost:Repaired store repaired/ at commit 3 (graph …): all data kept mark not carried: before-import @ commit 1 not carried: the history before commit 3, 1 mark and the store id (backups start anew); the store it was built from keeps them ok: all data kept not carried: the history before commit 3, 1 mark and the store id (backups start anew) kept in: damaged/ (keep it while you need them)The damage report of
store verifyand of a store in maintenance mode saysa repair keeps all datainstead ofa repair loses nothing, and so does the playground's Store menu. In RustRepairReport::not_carried()returns the same words, in Python the report ofStore.repair_to()has them under the new key"not_carried". The exit codes do not change (Damage, Maintenance and Repair). -
graphersal embed-model importprinted a library error with a doubled headline (Error: Error: …); it now has oneError:like every other command. -
Playground: closing the Store menu with its button no longer reloads it (#25).