Files
markitect-tool/workplans/MKTT-WP-0007-advanced-query-and-local-index-backend.md

2.9 KiB

id, type, title, domain, status, owner, topic_slug, planning_priority, planning_order, depends_on_workplans, related_workplans, created, updated, state_hub_workstream_id
id type title domain status owner topic_slug planning_priority planning_order depends_on_workplans related_workplans created updated state_hub_workstream_id
MKTT-WP-0007 workplan Advanced Query and Local Index Backend markitect todo markitect-tool markitect P2 60
MKTT-WP-0006
MKTT-WP-0010
2026-05-03 2026-05-04 d61a82e4-651a-4df2-944a-9ff996b2e1f6

MKTT-WP-0007: Advanced Query and Local Index Backend

Purpose

Implement the first practical backend use case: cached AST introspection, JSONPath querying, SQLite metadata, and FTS5 search over Markdown documents.

This backend should later be able to index MKTT-WP-0010 references, named regions, chunks, and processor provenance without changing its basic storage contract.

P7.1 - Implement local snapshot store

id: MKTT-WP-0007-T001
status: todo
priority: high
state_hub_task_id: "8894a9a4-586c-457b-b4e6-add8276ff5f2"

Persist parsed document snapshots and source metadata in a local cache directory.

P7.2 - Add AST introspection commands

id: MKTT-WP-0007-T002
status: todo
priority: high
state_hub_task_id: "fb9eaa9d-5c20-49a9-a7a6-acae28ac5e20"

Add:

mkt ast show <file>
mkt ast stats <file>

Use the current parsed document and token model. Do not require cache presence for single-file use.

P7.3 - Add optional JSONPath query adapter

id: MKTT-WP-0007-T003
status: todo
priority: high
state_hub_task_id: "a7b46b32-f322-4fe0-a6fb-60b0b823593c"

Support JSONPath over Document.to_dict() behind an optional dependency and shared query result envelope.

P7.4 - Build SQLite metadata and JSON index

id: MKTT-WP-0007-T004
status: todo
priority: medium
state_hub_task_id: "479f11a3-4ab4-451b-991c-7f143f2bffea"

Persist source files, content hashes, frontmatter, headings, sections, blocks, and metrics in SQLite.

Keep schema extension points for reference edges, named regions, chunks, and processor outputs.

id: MKTT-WP-0007-T005
status: todo
priority: medium
state_hub_task_id: "0f03e9be-b6f0-4e4b-8220-3bbf638a892b"

Add full-text search over section and block text with source spans and relevance ranking.

P7.6 - Add incremental refresh

id: MKTT-WP-0007-T006
status: todo
priority: medium
state_hub_task_id: "7d9472e6-0716-435b-866c-d2c66ad786cf"

Refresh only changed files based on content hash and parser version.

Include dependency invalidation hooks for future transclusion/reference graphs.

P7.7 - Add local index CLI

id: MKTT-WP-0007-T007
status: todo
priority: high
state_hub_task_id: "35cc63ff-3723-43d5-aaf6-f9312efa0f4b"

Add:

mkt cache init
mkt cache build <path>
mkt cache query <selector-or-query>
mkt search <text>

Exit Criteria

  • Legacy AST/JSONPath value is recovered as an optional backend.
  • Local repeated queries are faster and explainable.
  • Simple selectors still work without cache.