Skip to content

0.6.4 — read-only graph query

Latest

Choose a tag to compare

@kjoshi07 kjoshi07 released this 08 Jul 13:02
62d7526

agentforge-graph 0.6.4 — ask the graph anything structural

Theme: query. The CKG already answered questions through fixed, typed verbs
(ckg search, ckg impact, ckg routes, …) — each great for the question it
was built for, but a closed set. 0.6.4 adds the escape hatch: a read-only,
guard-railed structural query surface so any exact question over the graph is
answerable directly, without us shipping a new verb.

Highlights

ckg query --graph / ckg_query — a read-only Cypher subset (feat-015)

# "classes tagged Repository with no inbound CALLS", "interfaces implemented by many classes", …
ckg query --graph 'MATCH (c:Class)-[:IMPLEMENTS]->(i:Interface)
                   RETURN i.name, count(c) AS impls ORDER BY impls DESC'

ckg query --graph 'MATCH (f:Function) WHERE NOT (f)<-[:CALLS]-() RETURN f.name, f.path'
ckg query --graph '<q>' --format json      # {columns, rows, truncated, stopped_reason}
ckg query --schema                          # the queryable vocabulary
  • The escape hatch, not a replacement. For semantic "find code about X" use
    ckg_search; for "who calls this" use ckg_impact. ckg_query is for precise
    structural
    questions with exact predicates — MATCH patterns (directions,
    bounded var-length [:CALLS*1..3]), WHERE (comparisons, AND/OR/NOT, IN,
    STARTS/ENDS WITH, CONTAINS, pattern existence), RETURN with
    count/min/max/avg/collect, ORDER BY/SKIP/LIMIT.
  • Safe by construction. Caller text is never executed. It is parsed into a
    validated AST (the single trust boundary), then compiled to native Cypher
    (Kuzu, Neo4j) or interpreted over the storage API (SurrealDB, and any
    backend without a query language). Writes/DDL, procedure calls, unbounded paths,
    and un-joined Cartesian products are rejected with a clear reason — never a
    stack trace.
  • Identical on every backend. A shared conformance suite proves Kuzu, Neo4j,
    and SurrealDB return the same rows for the same query.
  • Bounded, no silent caps. query.max_rows / timeout_ms / max_expansions
    are enforced on every backend and reported via truncated + stopped_reason,
    so a partial answer is never mistaken for a complete one.
  • For agents too. A capability-gated ckg_query MCP tool (present only when
    the backend is query-capable and query.allow_in_mcp is on) with the usual
    staleness envelope; ckg status reports the query-language version.

See the new guide: Ad-hoc structural queries.

Fixed

  • Re-exported base classes now resolve. A base class imported via an absolute
    path and re-exported through a package __init__.py (e.g.
    class KuzuGraphStore(GraphStore)) previously produced no INHERITS edge. The
    resolver now binds through a package re-export namespace — improving INHERITS
    and CALLS recall for every consumer (retrieval, impact, repo-map), not
    just the query surface.