Primitive of the day
One free, complete primitive every day — a small building block you can drop into your own agent skill.
2026-11-10 ·
reflection-loop-max-retry-capEvery critic-revise (reflection) loop gets an explicit max_retry cap plus a quality bar that ends it early - never loop until 'good'.
2026-11-09 ·
branch-single-checkout-constraintBy default a branch can be checked out in only one worktree — `git worktree add` refuses with `fatal: '<branch>' is already used by worktree at '<path>'` (rc=128); `--force` overrides it, which is how two worktrees end up writing to one branch. Plan one branch per parallel agent/worktree and read the refusal as by-design, never as corruption to work around.
2026-11-08 ·
qa-gate-read-only-caller-decidesA QA gate reports and exits nonzero - it never deletes, edits, or regenerates the artifacts it judges; the caller decides remediation.
2026-11-07 ·
lazy-singleton-model-loadLoad a heavyweight model once via a module-level lazy singleton so repeated pipeline calls pay the multi-second load/download only on first use.
2026-11-06 ·
record-negative-resultsA candidate requirement tested and REJECTED bounds the system -- record it as a finding; it is progress, not noise.
2026-11-05 ·
no-auto-install-in-untrusted-reposAutomatic dependency install (npm/pip/bundle/go) runs third-party package managers that may execute install scripts and fetch from the network — keep auto-install OFF when the repo is untrusted.
2026-11-04 ·
plan-constraint-check-upfrontCheck hard constraints (data availability, authorization, budget, deadlines) BEFORE executing a plan - a late-invalidated plan is wasted work and mid-execution replanning is expensive.
2026-11-03 ·
plan-per-section-no-editsFor each approved section, have the agent write a section-scoped plan — what changes, which other sections/files might be affected, and the smallest change that achieves the goal — returned with zero edits, and execute only after that plan is approved.
2026-11-02 ·
approved-map-before-any-editBefore an agent edits a large file, require a no-edit MAP of its logical sections (name, approximate line range, one-sentence purpose, coupling risks) and a human approval of that map — the one cheap moment to re-scope.
2026-11-01 ·
worktree-branch-survives-removalThe branch SURVIVES `git worktree remove` — repeated create/remove cycles silently accumulate orphan branches, and re-running with the same name fails because -b refuses an existing branch; delete with branch -D on the discard path, or use -B to reset it only when its commits are disposable.
2026-10-31 ·
worktree-remove-refuses-uncleangit worktree remove refuses a worktree with uncommitted changes (rc=128); pass --force explicitly when the changes should be discarded — the refusal is a safety default, not an error.
2026-10-30 ·
generalization-second-clean-roundConvergence needs two consecutive clean rounds where the SECOND is a generalization test on a fresh un-tuned slice -- a clean round on tuned material proves nothing.
2026-10-29 ·
worktree-detach-throwawayFor approaches you expect to discard, create the worktree with --detach (detached HEAD, no branch) — nothing to clean up branch-wise when the losing candidates are removed.
2026-10-28 ·
tiered-history-compression-ladderCompress conversation history on a three-level ladder triggered by a token threshold (e.g., 4K): keep the last K turns verbatim; summarize earlier turns into bullet-point key decisions; aggressively reduce to key facts, decisions made, and current state.
2026-10-27 ·
git-dash-c-relative-path-resolutionA relative path argument under `git -C $REPO` resolves against the -C directory, NOT the caller's cwd — `git -C <repo> worktree add ../worktrees/x` lands sibling to the repo root no matter where the agent runs from.
2026-10-26 ·
flat-schema-for-small-local-modelsShape JSON schemas to the local model's size: flatten to <=2 nesting levels (at 3+ levels small models return empty arrays at depth), wrap nested lists in a BaseModel instead of List[List[str]], split schema dicts over ~2KB into sequential extraction calls, and reserve deep/complex schemas for >=12B models (flat 2-level verified fine on 9.4B glm4).
2026-10-25 ·
ollama-capability-check-api-showBefore substituting a model into a vision (or other capability) slot, check its capabilities via POST /api/show - don't assume a tag supports the capability.
2026-10-24 ·
fallback-ladder-priority-orderOrder recovery fallbacks cheapest-first: simpler method, then cached/saved data, then a safe default answer, then human-in-the-loop.
2026-10-23 ·
no-test-runner-manual-gateIf a checkpoint script detects no test runner, it must not silently pass: emit a warning and block on explicit human confirmation of manual verification before the loop continues.
2026-10-22 ·
unpack-cross-library-tuples-by-nameSibling utilities can return the same logical pair in REVERSED tuple order ((score,text) vs (text,score)) — when chaining libraries, never assume tuple element order; destructure explicitly per producer.
2026-10-21 ·
qdrant-query-points-over-searchqdrant-client REMOVED client.search() in 1.18+ - write against query_points (available since ~1.10) so code survives client upgrades.
2026-10-20 ·
opro-optimizes-the-judge-not-ground-truthAn LLM-as-optimizer maximizes the judge metric, not ground truth — metric gaming is an expected failure mode; a downstream refinement/review gate must catch it before adoption.
2026-10-19 ·
like-wildcard-pattern-escapeBinding stops query-TEXT injection but %/_ inside a bound LIKE parameter still act as wildcards (pattern injection) — escape or validate LIKE inputs as a separate step.
2026-10-18 ·
mlx-export-gguf-family-allowlistmlx_lm.fuse --export-gguf works ONLY for model_type llama/mixtral/mistral — any other family (Qwen, Phi, Gemma, ...) hard-raises 'ValueError: Model type X not supported for GGUF conversion'; route those through fuse-to-HF + llama.cpp convert_hf_to_gguf.py.
2026-10-17 ·
llm-validator-client-requiredinstructor.llm_validator's real 1.15.4 signature is llm_validator(statement, client, allow_override=False, model='gpt-3.5-turbo', temperature=0) — the client positional is REQUIRED and there is no allow_reask parameter (older examples showing it are stale; closest is allow_override).
2026-10-16 ·
embeddingfunc-no-double-wrapLightRAG functions already decorated with @wrap_embedding_func_with_attrs (ollama_embed is) must be called via .func — wrapping them AGAIN inside EmbeddingFunc() is a documented upstream error pattern; the lambda-inside-EmbeddingFunc idiom is the aging form.
2026-10-15 ·
gbnf-performance-rulesIn GBNF, chained optionals (x? x? x?) explode the FSM — use bounded repetition x{0,N} (max 2000 repetitions per rule in llama.cpp), prefer negated character ranges over enumerations, and keep grammars shallow.
2026-10-14 ·
dia-parenthesized-nonverbal-whitelistDia non-verbal cues are PARENTHESIZED — (laughs), never [laughs] — and only the 21 tags listed in the Dia README are recognized; even those may give unexpected output, so use them sparingly.
2026-10-13 ·
llm-judge-gate-fail-open-parseIf an LLM-judge gate defaults to PASS when the judge's JSON can't be parsed (fail-open), a garbled verdict never fails the gate - audit the reasons field whenever a batch looks suspiciously clean.
2026-10-12 ·
dot-git-is-file-in-worktreeIn a linked worktree `.git` is a FILE (a gitdir pointer), not a directory — any tool, hook, or script that assumes a .git/ directory breaks inside worktrees; test with [ -f .git ].
2026-10-11 ·
dspy-pypi-name-not-dspy-aiInstall DSPy as 'pip install dspy' — 'dspy-ai' is the older package name and today only an alias that installs dspy; confirm with an import check after install.
2026-10-10 ·
probe-full-depth-not-namesProbe the FULL instance (body, content, acceptance, relations, internal structure) — never its name, label or title: name-level classification yields all-confirmations and a FAKE early saturation that ends a discovery sweep or drain loop far too early (measured: name-matching 'saturated' at ~200 of 47k nodes while full-depth reads still yielded ~3 new design elements per node). When the finding-rate drops to ~0, first verify you are reading complete bodies before believing the corpus is dry.
2026-10-09 ·
cheap-inference-strong-reflection-splitSplit an optimization loop across two models by call profile: a cheap local model runs the many forward passes, a strong subscription model (no per-call cost) runs the few reflection steps — the whole search runs at zero pay-per-use spend.
2026-10-08 ·
filter-per-step-not-per-taskJudge context relevance against the current step at each assembly, drawing from the full collected pool each time, rather than permanently pruning at the whole-task level — step-scoped filtering keeps later-step material recoverable.
2026-10-07 ·
textgrad-wrap-inputs-as-variablesTextGrad's BlackboxLLM and TextLoss operate on tg.Variable objects, never raw strings — wrap every input, with requires_grad=True only on the text being optimized and requires_grad=False on task briefs.
2026-10-06 ·
pydantic-v2-validationerror-not-constructibleNever construct pydantic ValidationError(f"...") yourself — in Pydantic v2 it is not constructible from a string and crashes with TypeError (verified on 2.12.5); raise your own exception class with the caught ValidationError chained via 'from last_err' instead.
2026-10-05 ·
mlx-vlm-generate-returns-dataclassmlx_vlm.generate() returns a GenerationResult dataclass, not a str — read .text for the answer (with free stats in .generation_tps/.peak_memory/.cached_tokens); str(result) yields the full dataclass repr.
2026-10-04 ·
pre-prompted-buttons-over-open-textboxFor customer-facing LLM apps at scale, prefer canned prompt buttons over an open text box - kills the injection vector entirely and tightens context-engineering control.
2026-10-03 ·
chunk-refactor-trigger-thresholdsRule of thumb (thresholds not measured): switch from single-pass to chunk-and-checkpoint refactoring when the file exceeds ~200 lines, mixes multiple concerns, cannot be fully tested in under ~30 seconds, or a previous large agent change proved hard to debug.
2026-10-02 ·
rank-order-not-absolute-thresholdCross-encoder scores are model-config-dependent raw logits (measured -11.4 to +7.8 on the default model) — consume rank order only, never threshold on absolute score.
2026-10-01 ·
ollama-bge-m3-dense-head-onlyOllama's bge-m3 GGUF serves ONLY the dense 1024-d head - sparse and ColBERT heads require FlagEmbedding's HF weights (a separate ~2.3 GB download), and FlagEmbedding cannot load the Ollama GGUF.
2026-09-30 ·
opro-history-overflow-trim-oldestWhen the (prompt, score) history overflows the optimizer model's context, trim the oldest pairs first — preserve the recent trajectory rather than truncating arbitrarily.
2026-09-29 ·
identifiers-need-allowlist-not-paramsIn SQL, binding covers VALUES only: `FROM ?` is a syntax error, so table and column names must come from an ALLOWLIST — the residual injection surface. In Cypher the bare `MATCH (n:$lbl)` is a syntax error too, but current Neo4j (measured on 2025.09) binds labels and relationship types through `$(…)`: `MATCH (n:$($lbl))`, `-[r:$($t)]->`; on older versions, use an allowlist.
2026-09-28 ·
finetune-chat-template-exact-matchA fine-tuned GGUF that loads fine but generates garbage/repetition almost always has a chat-template mismatch — the Ollama Modelfile TEMPLATE must be character-for-character the template the training data used; prevent the whole class by using tokenizer.apply_chat_template() at data-prep time.