Skip to content
Back to skills

Decisions

ASecurity

UserPromptSubmit hook pre-seeds Python query results before the query skill runs Glob/Grep

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
developmentpythonrustshell

Works with

  • cli

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add zimalabs/code-decisions --skill decisions --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Decisions?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Decisions
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/zimalabs-decisions/badge)](https://www.skillsdirectory.com/skills/zimalabs-decisions)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "query-preseed-hook-for-skill"
description: "UserPromptSubmit hook pre-seeds Python query results before the query skill runs Glob/Grep"
date: "2026-03-19"
tags:
  - "plugin-architecture"
  - "hooks"
  - "query"
affects:
  - "src/decision/policy/defs.py"
---

# Query-preseed hook to combine Python scorer with native tool search



Added a `query-preseed` policy on `UserPromptSubmit` that detects `/decision:query <keywords>` and runs `store.query()` (Python keyword scorer) to inject ranked results before the skill fires. The skill then uses Glob/Grep/Read to dig deeper into matches. This gives the agent the best of both: fast scored ranking from Python + full file access from native tools.

## Alternatives
- Shell out to Python from the skill — the skill could tell the agent to run `python3 -m decision query`. However this violates the "use native tools" principle and the architecture rule of no CLI.
- Keep Python and skill search separate — the Python query only runs in hooks (related-context), the skill only uses Glob/Grep. But this means two search implementations that could diverge, and the skill misses the scoring logic.
- Replace skill search entirely with Python — make the skill just display Python results. But this removes the agent's ability to read full files and grep for additional terms the scorer missed.

## Rationale
The `_query_preseed_condition` in `src/decision/policy/defs.py` fires on `UserPromptSubmit` when it detects `/decision:query <keywords>`. It calls `store.query(keywords, RELATED_CONTEXT_LIMIT)` and injects results as a `reason` string. The skill (`src/skills/decision/SKILL.md`) now tells the agent to start with pre-seeded results and use native tools for deeper exploration.

## Trade-offs
Adds ~50-100ms to `UserPromptSubmit` processing when `/decision:query` is used — `store.query()` parses all decision files. The preseed only fires for explicit `/decision:query` invocations, not natural language queries like "what did we decide about caching." If the keyword scorer returns no matches but Grep would find them via substring, the agent might trust the empty preseed and stop looking.

Files in this skill

  • append-only-decisions.md721 B
  • bash-dispatch-fast-paths.md761 B
  • capture-nudge-corroboration-requirement.md2.3 KB
  • dispatch-errors-never-break-claude.md679 B
  • fts5-search-pipeline.md735 B
  • git-is-the-history-layer.md1.3 KB
  • incremental-sync-over-full-rebuild.md2.2 KB
  • markdown-source-of-truth.md736 B
  • merge-tags-stats-into-list.md1.8 KB
  • no-capture-confirmation.md725 B
  • policy-evaluation-order.md776 B
  • pure-methods-on-store.md527 B
  • query-preseed-hook-for-skill.md2.1 KB
  • search-skill-prefer-preseeded.md594 B
  • semver-versioning.md385 B
  • session-state-in-tmp.md684 B
  • single-skill-entry-point.md671 B
  • skill-hook-cli-boundary.md1.4 KB
  • stale-path-all-decisions.md632 B
  • stdlib-only-in-src.md619 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.