KeiSeiKit-1.0/_primitives/_rust/kei-task/atoms/search.md
Parfii-bot ae82bc6242 feat(stream-b): kei-task pilot — 3 atoms (create/search/add-dependency)
Pilot refactor per locked substrate schema. kei-task migrated to atom
layout:

- atoms/<verb>.md — YAML frontmatter + human body for 3 verbs
- atoms/schemas/<verb>-{input,output}.json — JSON Schema draft-07
- src/atoms/<verb>.rs — typed Input/Output/Error + pub fn run()
- src/atoms/mod.rs — module registry
- Cargo.toml [package.metadata.keisei] — crate-level substrate data
- src/main.rs — dispatcher for 3 pilot commands via atoms::

Zero behaviour change: 7/7 integration tests pass before and after
(create_and_get, update_persists, cycle_detected, milestone_linking,
dependency_chain_traversal, task_graph_edges, search_finds_task).

main.rs still has 5 non-migrated subcommands (update, graph,
dependency-chain, milestone, link-milestone) — scope discipline, they
migrate in later passes. main.rs 120 → 132 LOC.

Stream B pilot reference — other crates follow this pattern in v0.24+.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 00:09:55 +08:00

1.8 KiB

atom kind version input output errors side_effects idempotent timeout_ms deprecated stability keywords related
kei-task::search query 0.1.0
schema required example
schemas/search-input.json
query
query limit
refactor 20
schema example
schemas/search-output.json
results
id title status priority
42 refactor router pending high
code http_analog description
InvalidQuery 400 FTS5 rejected the query syntax
code http_analog description
StoreError 500 Underlying SQLite store failed during read
true 5000 null stable
task
search
fts
lookup
query
kei-task::create
kei-task::add-dependency

kei-task::search

Runs a FTS5 full-text search over task titles + descriptions and returns matches ordered by rank (FTS5 BM25 relevance).

Example

kei-task search "refactor" --limit 10

Tab-separated on stdout, one row per hit:

42	pending	refactor router
57	in_progress	refactor auth layer

Programmatic callers receive a typed array:

{
  "results": [
    { "id": 42, "title": "refactor router", "status": "pending", ... }
  ]
}

Gotchas

  • limit defaults to 20 and is clamped to a positive integer — pass 0 or negative and the implementation silently uses 20.
  • Query uses FTS5 syntax — phrase search needs double quotes inside the query string (shell escape required).
  • Returned rows always include the full Task shape; callers that only need id should project client-side.
  • Results are ordered by FTS rank, NOT by created_at — recent tasks may be returned in the middle of the result set.