Commit graph

315 commits

Author SHA1 Message Date
Andrey Avtomonov
13ebe4fb6f chore: build runtime artifacts in conductor setup 2026-05-14 23:08:33 +02:00
Andrey Avtomonov
6c73029d0c Merge remote-tracking branch 'origin/main' into explore-research-agent-tools
# Conflicts:
#	packages/cli/src/print-command-tree.test.ts
#	packages/context/skills/sl_capture/SKILL.md
2026-05-14 22:05:00 +02:00
Andrey Avtomonov
8fd8ae6388 docs: add research-agent MCP ingest contract convergence plan 2026-05-14 19:27:38 +02:00
Andrey Avtomonov
fd3a25f14e docs(context): update ingest verification prompts for connectionId 2026-05-14 19:25:59 +02:00
Andrey Avtomonov
e4f2863fed refactor(context): use connectionId in warehouse verification tools 2026-05-14 19:25:03 +02:00
Andrey Avtomonov
6179667e45 docs: add research-agent MCP setup-agents plan 2026-05-14 19:11:30 +02:00
Andrey Avtomonov
c35aa760e6 feat(cli): support Claude local MCP setup scope 2026-05-14 19:09:48 +02:00
Andrey Avtomonov
6cb03d6924 feat(cli): configure MCP clients in setup agents 2026-05-14 19:07:22 +02:00
Andrey Avtomonov
0955b36887 feat(cli): install KTX research skill 2026-05-14 19:05:46 +02:00
Andrey Avtomonov
d79c51abaa docs: add research-agent MCP http daemon plan 2026-05-14 18:55:22 +02:00
Andrey Avtomonov
88f91f27c2 fix(cli): stabilize mcp daemon verification 2026-05-14 18:54:18 +02:00
Luca Martial
5cf2c89093
Revise CLI reference docs (#100)
* docs: revise CLI reference

* docs: sync CLI reference with current commands
2026-05-14 12:53:55 -04:00
Andrey Avtomonov
a9c7c152f1
docs(agents): instruct agents to update docs-site after code changes (#99) 2026-05-14 18:53:44 +02:00
Andrey Avtomonov
3bba9eec79 feat(cli): add ktx mcp commands 2026-05-14 18:52:00 +02:00
Andrey Avtomonov
db09df4d72 feat(cli): manage mcp daemon lifecycle 2026-05-14 18:50:54 +02:00
Andrey Avtomonov
6bff3c3492 feat(cli): host mcp over streamable http 2026-05-14 18:50:08 +02:00
Andrey Avtomonov
7ffa99983f feat(cli): add mcp http security helpers 2026-05-14 18:47:50 +02:00
Luca Martial
372c90b533
Polish documentation copy (#98) 2026-05-14 12:43:14 -04:00
Andrey Avtomonov
e974f3e59f docs: add research-agent MCP discover_data plan 2026-05-14 18:38:18 +02:00
Andrey Avtomonov
fc903f32b7 feat: wire local discover data MCP port 2026-05-14 18:36:18 +02:00
Andrey Avtomonov
e74976d321 feat: expose discover data MCP tool 2026-05-14 18:35:30 +02:00
Andrey Avtomonov
6a61f209e2 feat: add MCP discover data service 2026-05-14 18:34:44 +02:00
Andrey Avtomonov
f1c073b614 docs: add research-agent MCP dictionary_search plan 2026-05-14 18:24:48 +02:00
Andrey Avtomonov
b8418c7a79 feat(context): expose local MCP dictionary search 2026-05-14 18:22:55 +02:00
Andrey Avtomonov
edb62deed2 feat(context): register MCP dictionary search tool 2026-05-14 18:22:25 +02:00
Andrey Avtomonov
d0b8996456 feat(context): add dictionary search service 2026-05-14 18:21:52 +02:00
Andrey Avtomonov
ff3a8c5777 docs: add research-agent MCP entity_details plan 2026-05-14 18:14:17 +02:00
Andrey Avtomonov
a27400b3dd test(context): align entity details scan fixtures 2026-05-14 18:13:23 +02:00
Andrey Avtomonov
da6f8873d4 feat(context): expose local MCP entity details 2026-05-14 18:11:27 +02:00
Andrey Avtomonov
9d9fa9bc3b feat(context): register MCP entity details tool 2026-05-14 18:10:03 +02:00
Andrey Avtomonov
700c0ba5d7 feat(context): add scan-backed entity details service 2026-05-14 18:09:16 +02:00
Andrey Avtomonov
371fcd47eb docs: add research-agent MCP sql execution foundation plan 2026-05-14 18:00:40 +02:00
Andrey Avtomonov
66e7c9fca4 test(context): update SQL analysis port fixtures 2026-05-14 17:59:21 +02:00
Andrey Avtomonov
807f86d761 feat(context): execute MCP SQL through validated connector path 2026-05-14 17:57:41 +02:00
Andrey Avtomonov
c774870346 feat(context): register MCP sql execution tool 2026-05-14 17:56:33 +02:00
Andrey Avtomonov
06f020dca1 feat(context): expose read-only SQL validation port 2026-05-14 17:55:23 +02:00
Andrey Avtomonov
aa4431b295 feat(daemon): validate read-only SQL with sqlglot 2026-05-14 17:54:36 +02:00
Andrey Avtomonov
ce23aca4c4
fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
Andrey Avtomonov
de9f4d97e7 Refine spec: drop connectionName compat carve-out and ground summary/snippet provenance per kind 2026-05-14 17:24:23 +02:00
Andrey Avtomonov
bef9d14b90 Refine research-agent MCP tools spec after adversarial review iteration 3 2026-05-14 17:06:35 +02:00
Andrey Avtomonov
1a79c0efc3 Refine research-agent MCP tools spec after adversarial review iteration 2 2026-05-14 16:58:28 +02:00
Andrey Avtomonov
9e6511182e Refine research-agent MCP tools spec after adversarial review iteration 1 2026-05-14 16:47:57 +02:00
Andrey Avtomonov
97ac2139bc docs(specs): design research-agent MCP tools and ktx mcp daemon
Adds the 2026-05-14 design spec for exposing four new MCP tools
(discover_data, entity_details, dictionary_search, sql_execution),
shipping a ktx-research skill, and introducing an HTTP-only ktx mcp
daemon so external agents can use KTX as a research-capable context
layer.
2026-05-14 16:42:40 +02:00
Andrey Avtomonov
2bca308863
feat(cli): add ktx dev schema to emit ktx.yaml JSON Schema (#93)
Annotates the Zod config schema with .describe() text on every field and
adds generateKtxProjectConfigJsonSchema() plus a ktx dev schema command
that prints (or writes) a draft-07 JSON Schema for editors and LLM agents.
2026-05-14 16:21:29 +02:00
Andrey Avtomonov
c7c5f63a66
feat(cli): extend ktx connection test to every supported driver (#92)
* feat(cli): extend `ktx connection test` to every supported driver

Dispatch by driver: native DBs now call `connector.testConnection()`
(was `introspect(dryRun)`), looker/notion/metabase hit their auth
endpoints, and dbt/metricflow/lookml run `git ls-remote` via the
existing `testRepoConnection` helper. Unknown drivers exit 1 with a
listing of supported ones.

* feat(cli): add `ktx connection test --all` summary list

Tests every configured connection in parallel and renders a single
Clack-style list (◇/│/◆/└, green ✓ / red ✗) consistent with sl list,
with per-row detail and a passed/failed footer. Exits non-zero if any
connection fails. Single-id `ktx connection test` output is preserved.

* fix(cli): read metabase status url from api_url

`ktx status` was probing `url` / `base_url` on metabase connections, but
ktx.yaml stores it as `api_url`, so the field always reported "url not
set". Read `api_url` directly and align the warning text with the actual
key.
2026-05-14 16:21:18 +02:00
Andrey Avtomonov
b3be54e3fa
refactor(context): validate ktx.yaml with Zod and surface issues in status (#91)
* refactor(context): validate ktx.yaml with Zod and surface issues in status

- Replace hand-rolled ktx.yaml parsing with a strict Zod schema and
  derive KtxProjectConfig types from it.
- Add validateKtxProjectConfig returning structured KtxConfigIssue[]
  with migration hints for deprecated keys (ingest.llm,
  scan.enrichment.backend, etc.).
- Wire ktx status/doctor to run validation, render schema issues in
  plain and JSON output, and add a Config row to project status.
- Update the orbit example to camelCase scan.relationships keys to
  match the schema.

* fix(context): tolerate legacy setup.completed_steps and optional driver

- Accept and drop the legacy setup.completed_steps field so existing
  ktx.yaml files migrated from older versions still load.
- Make connections.<id>.driver optional in the schema; runtime code
  already produces a clear "no driver" error at use time.

* feat(cli): add ktx status --validate to run only ktx.yaml schema validation

- New --validate flag dispatches a focused runKtxDoctor 'validate' branch
  that reads ktx.yaml, runs validateKtxProjectConfig, and skips LLM,
  connection, embedding, and query-history checks.
- Plain output prints a single Config row; JSON output emits
  {ok: true} on success or the existing invalid_config / missing_project
  shapes on failure.
2026-05-14 15:36:35 +02:00
Andrey Avtomonov
49f1e2720e
fix(llm): wire prompt caching through all Anthropic call sites (#90)
* fix(llm): wire prompt caching through all Anthropic call sites

- page-triage classifier + light-extraction now put the static skill
  prompt in `system:` so the per-document caches hit instead of
  re-sending boilerplate in the user message every call.
- Description generation builders return `{ system, user }` with
  instruction text + word limit moved into the cacheable system.
- Relationship-LLM proposal framing moved to `system:`.
- `KtxMessageBuilder.wrapSimple` skips the history breakpoint for
  single-message calls (cache write that could never be reused).
- Gateway backend now sets `anthropic-beta: extended-cache-ttl-2025-04-11`
  so 1h TTLs don't silently downgrade to 5m on Gateway routes.

* fix(llm): keep wrapSimple history breakpoint so multi-step agent loops cache

Reverts the wrapSimple `messages.length > 1` guard from the prior commit.
agent-runner uses wrapSimple with a single user message, but generateText
runs a multi-step tool loop inside it — the cache marker on the first user
message is reused by every subsequent step, so it isn't waste.
The release validator (scripts/validate-llm-debug-jsonl.mjs) also requires
a `message-part` marker target in captured debug JSONL.
2026-05-14 15:36:27 +02:00
Andrey Avtomonov
77cce79237
feat(cli): unify wiki and sl search output with clack-style box and score badge (#89)
Routes `ktx wiki list` and `ktx wiki search` through the shared printList()
renderer so all four list/search commands now produce the same Clack-style
pretty box, TSV plain output, and JSON envelope. Adds a `--output` flag to
the wiki commands mirroring sl, and surfaces relevance score as a leading
dim badge ("87%") in pretty mode and a `score=` prefix in plain mode for
both wiki search and sl search. Empty results now emit a consistent
actionable hint across commands.
2026-05-14 15:15:20 +02:00
Andrey Avtomonov
52dd89481c
fix(cli): keep ktx setup alive when a dbt git clone fails (#88)
Wraps the validation clone in defaultValidateDbt so auth or network
failures surface as a clean validation error instead of an unhandled
RepoFetchError that exits the wizard. Verifies pasted tokens with
testGitRepo before saving them as a secret so bad tokens are caught at
paste time. In interactive setup, validation failures now bounce the
user back to source selection (with a "Edit the connection or pick a
different source" hint) instead of killing the process; --source flag
mode still exits with failed as before.
2026-05-14 14:39:50 +02:00
Andrey Avtomonov
6c4623f2ff
feat(cli): enforce required database selection and improve tree-picker UX (#86)
* feat(cli): enforce required database selection and improve tree-picker UX

- Require at least one database driver via prompt `required: true` instead of
  looping on empty selection; remove the now-dead retry/back-on-empty branch.
- Surface the recommended option with a "(recommended)" hint in the depth and
  query-history prompts.
- Tree picker: add `◧` partial glyph for parents whose descendants are checked,
  and make `a` toggle select-all-visible / select-none.

* fix(cli): drop unused export from tree-picker toggleSelectAllVisible

Knip flagged the export as unused; the function is only consumed by the
internal reducer via the 'toggle-select-all-visible' command, so demote
it to a module-local helper to keep CI's dead-code check green.

* test(cli): drop empty-selection warning assertion from setup test

The empty-selection retry/warning loop in `chooseDrivers` was removed in
favor of `multiselect`'s `required: true`, so the legacy warning string
is unreachable. Update the test to assert the simpler back-from-selection
return-to-embeddings flow.
2026-05-14 14:35:58 +02:00