Repository navigation
Qsp example agent - #167
Open
mkeenan-di wants to merge 5 commits into
Open
mkeenan-di wants to merge 5 commits into
mkeenan-di wants to merge 5 commits into
Conversation
|
The diff is too large to review automatically (estimated 204,862 tokens, limit 90,000). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps
di.qspto 0.4.0. qsp now has what an LLM agent needs to query a policed kdb+ database: an MCP server in q, a primer, refusals as structured data, sizing before a query runs, and signed receipts. It also lets a single qsp compile a query and send it out across an estate (RDB/HDB executors). Behaviour changes are marked behaviour inCHANGELOG.md.What's new
Agents
mcp/mcp.q,mcp/qsp-mcp). Exposes qsp's calls as agent tools over stdio, with no Python. Also adds a Claude Code skill (skill/qsp/SKILL.md).api/primer.md,(`.qsp.api;`primer)). How to write q that qsp accepts, written on a made-up schema so it never names real columns.examples/primer/check.qruns every example in it.classifyreturnscode/kind/subject,codes[]lists them all (core/codes.q), and the audit log records the code.time.minute, unbalanced brackets (the message now names the bracket), aliases that shadow a server name, and keyed joins on a missing key.locate: shows where in a query q's error is, with a caret under the failing part.estimate,precheck,largeread,mingroup,maxqueries, and thebytes/descriptioncolumns inschema.csv.describegainsshape, table descriptions, and parameterised businessterms. Descriptions and terms are only shown to users who can read what they mention (behaviour).told[p;u]: shows what each user's brief tells them and what it withholds.bin/policy.qprints it for review.Estate: plans, executors, receipts
compile/finalize.runis split so a qsp holding only the policy can compile a query and seal the plan with HMAC. Executors run the sealed plan without qsp and attest the result (plan/init.q,estate/exec.q).executors). The planner answers a gateway'sexecasritself, so a client sends one message whatever the estate looks like.verify/receipt/reloadkeys.bin/serve.q: one launcher for a policy on a port. It replacesexamples/gateway/policy.q.di.qsp.cache: caches results by the md5 of the rewritten query.Query rewriting
date inlist (behaviour). This is the same change as theqsp-partition-foldPR; see Notes.asofsafe, which sorts and attributes the right side as needed. A day'sajover quotes went from 160s to about 1s with the same result (behaviour: an unsorted right side is now sorted).notsafe,ascsafe,descsafe,findsafe,asofsafe,wjsafe) are defined in one registry,core/swaps.q.xrankis permitted.crosscarries the columns of both sides.defs.qis loaded with the policy.Examples and docs
examples/agents/: Claude Code wired to the MCP server (agent.shand per-role slash commands), an eval harness with recorded results, and the agenticq scorers.examples/ticker/(compiler, gateway, and RDB/HDB executors),examples/gateway/, andexamples/primer/.docs/estate.mdanddocs/gateway.md, plus updates toconcepts.md,internals.mdandsecurity-review.md.Behaviour changes to check
validatereturns three new keys, and the audit log has eleven new columns. A policy that registers the audit log in itsschema.csvneeds these added.(eval;expr)instead of(eval;tree).explainandrunxshow what ran as q-SQL text instead of a parse tree.CHANGELOG.md, the 0.4.0 section, for the full list.Notes for reviewers
qsp-partition-foldPR (the partition fold ininit.q,ord.partfixed, the tests and the CHANGELOG entry). Merge that one first, then rebase this branch.examples/ticker/keys/contains demo-only plan and receipt keys. This is deliberate, and the ticker README says so. Real deployments make their keys outside the repo.Testing
bin/ci.sh: every suite passes.bin/policy.q -test🤖 Generated with Claude Code