Skip to content

Latest commit

 

History

History
88 lines (59 loc) · 4.11 KB

File metadata and controls

88 lines (59 loc) · 4.11 KB

aimeta installation

Prerequisites

aimeta is a kdb-x module — plain kdb+ 4.x won't load it. Install kdb-x first: code.kx.com/kdb-x.

Four kx modules are needed at runtime. The script below installs them under ~/.kx/mod/kx/; anywhere on $QPATH works.

Module Role Source
kx.ax qdoc parser used by the compiler KxSystems/ax
kx.fusion pcre2 binding, dep of kx.ax.qdoc KxSystems/fusionx releases
kx.printf printf-style formatter, dep of kx.log KxSystems/printf
kx.log module logger KxSystems/logging
KXMOD="$HOME/.kx/mod/kx"
mkdir -p "$KXMOD"

git clone --depth 1 https://github.com/KxSystems/ax.git /tmp/ax \
  && cp -r /tmp/ax/ax "$KXMOD/ax"

FUSIONX_VERSION=1.1.0
curl -sSLf -o /tmp/fusion.zip \
  "https://github.com/KxSystems/fusionx/releases/download/${FUSIONX_VERSION}/fusion.zip"
unzip -o /tmp/fusion.zip -d /tmp/fusion && cp /tmp/fusion/fusion.*.so "$KXMOD/"

git clone --depth 1 https://github.com/KxSystems/printf.git /tmp/printf \
  && cp /tmp/printf/printf.q "$KXMOD/"

git clone --depth 1 https://github.com/KxSystems/logging.git /tmp/logging \
  && cp /tmp/logging/log.q "$KXMOD/"

Installation

Install under $HOME/.kx/mod/ so use \kx.aimeta`resolves out of the box — the kdb-x module framework searches$QPATH(default$HOME/.kx/mod) for a directory tree matching the dotted module name. kx.aimetamaps tokx/aimeta`:

export QPATH="$QPATH:$HOME/.kx/mod"
mkdir -p ~/.kx/mod/kx/
cp -r aimeta ~/.kx/mod/kx/

Add the export to ~/.bashrc (or shell-equivalent) to persist the path across sessions. Once the module is in place, load it from any q process:

q)([compile; validateDir; discover; init; reload; setlvl; data; getTables; getTable; getFunctions; getFunction; getReferences; getReference]): use `kx.aimeta

Developing locally

When you're working on the module rather than just consuming it, copying into ~/.kx/mod/ after every edit gets old fast. Symlink the working tree instead — changes show up the moment you save, no rebuild step:

mkdir -p ~/.kx/mod/kx
ln -s "$(pwd)/aimeta" ~/.kx/mod/kx/aimeta
q -q <<< 'show key use `kx.aimeta; exit 0'   / lists exports from the working tree

Use the copy-based install above for production and CI; the symlink approach is only appropriate on a developer machine. Remove the symlink with rm ~/.kx/mod/kx/aimeta when you're done.

The kx-meta CLI

The module ships a shell-callable CLI at scripts/kx-meta.sh for compiling annotations from a build and probing running kdb+ processes. Add scripts/ to $PATH so you can invoke it without the prefix from any directory:

export PATH="$PATH:/path/to/ai-meta/scripts"

kx-meta discover opens a qIPC handle with a 5-second timeout so an unreachable host fails fast rather than hanging. Override via KX_META_IPC_TIMEOUT (milliseconds) on slow links.

Skills (Claude Code plugin)

plugins/kxmeta-skills/ ships two skills:

  • kxmeta-author — writing aimeta annotations. Triggers on "annotate this q file" or "why isn't this surfacing in meta.json".
  • kxmeta-discover — discovering metadata on a running kdb+ process. Triggers on "what tables does this host expose" or "interpret kx-meta output".

Both skills point at agent-guide.md for the wire model. The plugin tree bundles agent-guide.md, meta.schema.json, and openapi.json under plugins/kxmeta-skills/reference/, so a marketplace install is self-contained.

Plugin install (preferred)

claude --plugin-dir /path/to/ai-meta/plugins/kxmeta-skills

Skills become reachable as /kxmeta-skills:kxmeta-author and /kxmeta-skills:kxmeta-discover, auto-load on triggers, and pick up edits with /reload-plugins.