context-hub
Context Hub
Use chub as the default source of truth for third-party API/SDK behavior.
Repo Sync Before Edits (mandatory)
When the task will modify files in a git repository, sync first.
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"
If the working tree is dirty, stash before syncing, then pop after sync.
If origin is missing or rebase conflicts happen, stop and ask the user.
1) Ensure chub is ready
Run:
chub help
chub update
If chub is not installed and installation is allowed, run:
npm install -g @aisuite/chub
If installation is blocked, tell the user and use official docs directly.
2) Identify target docs
Run:
chub search "<library or API name>" --json
Choose the best id (<author>/<name>, for example openai/chat, stripe/api).
If results are weak, retry with broader keywords.
3) Fetch language-specific docs
Run:
chub get <id> --lang py
Use the project language (py, js, ts) when variants exist.
Omit --lang when only one variant is available.
Prefer focused fetches when possible:
chub get <id> --file <reference-file>
Use --full only when full package context is required.
4) Implement from fetched docs only
Write code and explanations from fetched docs. Do not guess method names, payload fields, endpoint paths, or auth headers. When uncertain, fetch again instead of inferring.
5) Capture durable learnings
If you discover a real gap (gotcha, workaround, version quirk), store it:
chub annotate <id> "<concise actionable note>"
Keep notes short, concrete, and non-duplicative.
6) Submit doc feedback only with user approval
Ask the user before sending feedback.
chub feedback <id> up
chub feedback <id> down --label outdated
Common labels:
outdated, inaccurate, incomplete, wrong-examples, wrong-version, poorly-structured, accurate, well-structured, helpful, good-examples.
Quick commands
chub search "stripe"
chub get stripe/api --lang js
chub annotate stripe/api "Webhook verification requires raw body"
chub annotate --list