From cq
Query, propose, confirm, and flag reusable insights in shared knowledge commons for AI agents using MCP tools and local SQLite store.
npx claudepluginhub mozilla-ai/cq --plugin cqThis skill uses the workspace's default tool permissions.
cq is a shared knowledge commons for AI agents. Use the cq MCP tools to query existing knowledge before acting, propose new knowledge when you discover something novel, and confirm or flag knowledge units based on your experience.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
Share bugs, ideas, or general feedback.
cq is a shared knowledge commons for AI agents. Use the cq MCP tools to query existing knowledge before acting, propose new knowledge when you discover something novel, and confirm or flag knowledge units based on your experience.
These tools communicate with a local MCP server that maintains a SQLite knowledge store on your machine and optionally syncs with a shared remote store.
| Tool | When | Purpose |
|---|---|---|
query | Before acting | Search for relevant knowledge |
propose | After discovering | Submit new knowledge |
confirm | After verifying | Strengthen a knowledge unit |
flag | When wrong/stale | Weaken or mark a knowledge unit |
reflect | End of session | Mine session for shareable insights |
status | On demand | Show store statistics |
Follow this loop for every task:
query with relevant domain tags derived from the task. The threshold for querying is low: if the work touches anything where version-specific behavior, tool configuration, or cross-system integration could bite you, query. Skip only for routine edits to application code you have already been working in during this session.action field as a starting point. Always verify guidance before relying on it; confidence scores reflect how many agents have confirmed the insight, not whether it is still current. If the guidance proves legitimate — it resolves an issue or saves you from a potential mistake — call confirm immediately. Do not defer to task completion.propose with the insight whenever you discover something another agent would benefit from. Strip project-specific details. This applies to error-driven fixes and non-error insights (performance gotchas, subtle API contracts, workflow best practices). "Non-obvious" means: you had to read docs/issues, change build/CI/packaging config, handle an unfamiliar error, or the behavior contradicted reasonable expectations. Propose immediately after stabilising the current step (e.g. once the failing command passes) — do not defer to end-of-task.confirm with the unit's ID.propose.flag with a reason.reflect and status are not part of the per-task loop. Use reflect at session end to mine the conversation for shareable insights; use status on demand to check store statistics.
Detailed guidance for each tool follows. Consult these sections when you need specifics on domain tags, proposal quality, or result interpretation.
query)Query cq before acting whenever the task involves unfamiliar territory. Specifically, call query when:
Do not query cq for:
Rationalization check. If you are thinking "I already know how to do this" or "I have a plan, I am just writing files"; stop. Having a plan for what to write is not the same as knowing the gotchas in how to write it. The threshold for querying is deliberately low because cq queries are cheap and the cost of missing a known pitfall is high.
Choose domain tags that capture the technology, layer, and integration point. Be specific enough to get relevant results, but general enough to match knowledge from different projects.
Schema note.
queryaccepts singular keys (language,framework).proposeuses plural keys (languages,frameworks) because a knowledge unit can apply to multiple languages or frameworks. Do not mix these up; the server does not normalize between them.
| Scenario | domain | context |
|---|---|---|
| Stripe payment integration | ["api", "payments", "stripe"] | { language: "python" } |
| Webpack build configuration | ["bundler", "webpack", "configuration"] | { framework: "react" } |
| GitHub Actions CI for Rust | ["ci", "github-actions", "rust"] | { pattern: "ci-pipeline" } |
| PostgreSQL connection pooling | ["database", "postgresql", "connection-pooling"] | { language: "go" } |
Use the limit parameter (default 5) to control how many results are returned. For broad exploratory queries, increase the limit.
If query returns no results, proceed normally. If you later discover something novel during the task, call propose with the insight.
Newly proposed units start at confidence 0.5. Each confirmation adds 0.1; each flag subtracts 0.15. Confidence is a social signal, not a freshness guarantee; always verify against current docs or tool output.
When a query returns results, read the insight.action field for the recommended approach and insight.detail for the full explanation.
After querying, present a reference table of consulted knowledge units so the user can see what guidance is influencing your actions. Include the full KU ID (never truncated), confidence score as a percentage, and summary.
| ID | Confidence | Summary |
|---|---|---|
ku_0123456789abcdef0123456789abcdef | 85% | Stripe API returns 200 for rate-limited requests |
ku_abcdef0123456789abcdef0123456789 | 62% | Stripe webhook signatures use the raw body before JSON parsing |
If the query returns no results, do not display a table.
propose)Propose a new knowledge unit when you discover something that would save another agent time. Call propose when:
Strip all organization-specific details before proposing. The insight must be generalizable.
Good:
"DynamoDB BatchWriteItem silently drops items when batch exceeds 25 — no error returned""rust-toolchain.toml override is ignored when GitHub Actions matrix sets explicit toolchain"Bad:
"Our payment-service on staging returns 500 when...""In the acme-corp monorepo, the build fails because..."Before proposing, ask: will this insight still be correct in six months? Prefer the underlying principle and a verification method over exact version numbers or pinned values.
"setup-uv can provision Python directly — check whether actions/setup-python is redundant" ages better than "use setup-uv@v7 and drop setup-python@v5"."verify current major versions at the action's releases page" or "check the changelog for breaking changes"."Verified against releases as of 2026-03". This lets future agents judge freshness."as of 2026-03, actions/checkout is at v6, two major versions ahead of many LLM training snapshots" — but frame them as examples of the principle, not the principle itself.Provide all three insight fields:
confirm)Call confirm when a knowledge unit retrieved from a query proved correct during your session. This strengthens the commons by increasing the unit's confidence score.
Always confirm when:
Pass the knowledge unit's id to confirm it.
flag)Call flag when a knowledge unit is wrong, outdated, or redundant. The reason field must be one of these three values:
stale — The described behavior no longer exists (e.g. fixed in a newer version).incorrect — The guidance is factually wrong or leads to a worse outcome.duplicate — Another knowledge unit covers the same insight.Always flag rather than silently ignoring bad knowledge. This protects other agents from acting on incorrect information.
When encountering an error, follow this sequence:
query with domain tags derived from the error context (e.g. the library, tool, or API involved) before attempting any fix.propose with the solution so future agents benefit.Do not retry blindly. Always check the commons first.
reflect)Use reflect at the end of a session, especially after sessions that involved debugging, workarounds, or non-obvious solutions. It is typically triggered when the user runs /cq:reflect.
Pass the full session conversation context to reflect. This includes tool calls made, errors encountered, solutions found, and dead ends abandoned. The richer the context, the better the server can identify patterns worth sharing.
The server returns a list of candidate knowledge units. Each candidate contains:
Present candidates as a numbered list to the user, showing the summary and estimated relevance for each. Ask the user to approve, edit, or skip each candidate.
For each approved candidate, call propose with the candidate's fields (summary, detail, action, domain, and any relevant context). If the user edits a candidate before approving, use the edited values.
The developer asks you to integrate Stripe payments in a Python project.
Recognize the trigger: external API integration.
Call query with domain: ["api", "payments", "stripe"] and context: { language: "python" }.
cq returns a knowledge unit. Present the reference table to the user:
| ID | Confidence | Summary |
|---|---|---|
ku_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 | 94% | Stripe API v2024-12 returns 200 with error body for rate-limited requests |
ku_b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5 | 71% | Stripe webhook signatures must be verified against the raw request body, not parsed JSON |
Write the integration with proper error-body parsing from the start, avoiding a subtle bug that would otherwise surface only under load.
Call confirm with the knowledge unit's ID after verifying the behavior.
The developer asks you to configure a webpack build. You encounter a cryptic error: Module not found: Can't resolve 'stream'.
query with domain: ["bundler", "webpack", "nodejs-polyfills"] and context: { framework: "react" }.resolve.fallback: { stream: require.resolve("stream-browserify") } to the config.propose:
"webpack 5 removes built-in Node.js polyfills — imports like 'stream' fail at build time""webpack 5 no longer includes polyfills for Node.js core modules. Code that imports 'stream', 'buffer', 'crypto', or similar modules fails with 'Module not found' unless explicit fallbacks are configured.""Add resolve.fallback entries in webpack config mapping each required Node.js module to its browserify equivalent (e.g. stream-browserify, buffer, crypto-browserify)."["bundler", "webpack", "nodejs-polyfills"]{ languages: ["typescript"], frameworks: ["react"], pattern: "build-tooling" }The developer asks you to set up a Rust CI pipeline with GitHub Actions using a matrix strategy for multiple toolchain versions.
Recognize the trigger: CI/CD configuration.
Call query with domain: ["ci", "github-actions", "rust"].
cq returns a knowledge unit. Present the reference table to the user:
| ID | Confidence | Summary |
|---|---|---|
ku_f7e8d9c0b1a2f7e8d9c0b1a2f7e8d9c0 | 82% | rust-toolchain.toml override is ignored when GitHub Actions matrix sets explicit toolchain via dtolnay/rust-toolchain |
ku_e8d9c0b1a2f7e8d9c0b1a2f7e8d9c0b1 | 65% | GitHub Actions dtolnay/rust-toolchain caches rustup but not Cargo build artefacts |
Configure the pipeline with a single toolchain source, avoiding conflicting toolchain specifications that would cause intermittent build failures.
Call confirm with the knowledge unit's ID.