Skip to content
Merged

Cc #23

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
fd76851
fix ci and generated host artifacts
pankaj4u4m May 18, 2026
da8f27e
feat(code-intel): Introduce multiple new operations and enhancements
pankaj4u4m May 18, 2026
4924c23
docs: map codebase
pankaj4u4m May 18, 2026
475b830
feat: add M17 cross-language edge resolution documentation
pankaj4u4m May 18, 2026
c63a4c1
docs: initialize project
pankaj4u4m May 18, 2026
36fab05
chore: add project config
pankaj4u4m May 18, 2026
972fb2c
docs: define v1 requirements
pankaj4u4m May 18, 2026
0bbea5b
docs: create roadmap (7 phases)\n\nCo-authored-by: Copilot <223556219…
pankaj4u4m May 18, 2026
c9366f1
docs(01): add phase research and validation
pankaj4u4m May 18, 2026
46b1b8b
docs(01): add pattern map
pankaj4u4m May 18, 2026
3c6d365
docs(01): create phase plan
pankaj4u4m May 18, 2026
9561241
test(01-01): add failing budget wrapper regression
pankaj4u4m May 18, 2026
7772369
feat(01-01): harden code-context cache and budget packing
pankaj4u4m May 18, 2026
9806a3f
refactor(01-01): stabilize budget-fit regression fixture
pankaj4u4m May 18, 2026
ce0f615
test(01-01): lock gateway cache and telemetry regressions
pankaj4u4m May 18, 2026
68cc8ae
feat(01-01): add code-intel symbol search smoke harness
pankaj4u4m May 18, 2026
c4193ff
fix(01-01): type budget-fit helper for strict mypy
pankaj4u4m May 18, 2026
2ae8636
refactor(01-01): stabilize gateway budget regression fixture
pankaj4u4m May 18, 2026
527e09f
docs(01-01): complete retrieval core cache foundation plan
pankaj4u4m May 18, 2026
5e4f762
test(01-02): add failing routed symbol store tests
pankaj4u4m May 18, 2026
3f05a7d
feat(01-02): add routed symbol store delegation seams
pankaj4u4m May 18, 2026
1292b12
test(01-02): add failing SCIP routing regressions
pankaj4u4m May 18, 2026
4cdafb3
feat(01-02): add repo-local SCIP symbol routing
pankaj4u4m May 18, 2026
8a309a5
test(01-02): prove routed SCIP MCP and benchmark gates
pankaj4u4m May 18, 2026
083d2e1
fix(01-02): stabilize SCIP benchmark and typing gates
pankaj4u4m May 18, 2026
cecc875
docs(01-02): complete routed SCIP backend plan
pankaj4u4m May 18, 2026
b67d649
test(01-03): add failing hardened code search gateway coverage
pankaj4u4m May 18, 2026
eb2e854
feat(01-03): harden code search surface
pankaj4u4m May 18, 2026
9ac345e
test(01-03): add failing snippet packing regressions
pankaj4u4m May 18, 2026
44f2cd7
feat(01-03): tighten snippet packing and ranking defaults
pankaj4u4m May 18, 2026
852d1e7
test(01-03): close validation and benchmark evidence
pankaj4u4m May 18, 2026
ba58a03
docs(01-03): complete hardened code search plan
pankaj4u4m May 18, 2026
010ef7c
test(01): persist human verification items as UAT
pankaj4u4m May 18, 2026
e48a848
docs(phase-01): complete phase execution
pankaj4u4m May 18, 2026
00712f0
docs(phase-01): evolve PROJECT.md after phase completion
pankaj4u4m May 18, 2026
dd8babb
docs(02): add phase research and validation
pankaj4u4m May 18, 2026
3126c61
docs(02): add pattern map
pankaj4u4m May 18, 2026
bff3346
docs(02): create phase plan
pankaj4u4m May 18, 2026
9e9daf7
docs(02): revise phase plan
pankaj4u4m May 18, 2026
b966fdd
docs(02): finalize phase plan
pankaj4u4m May 18, 2026
8c2f2a4
test(02-01): add failing ast-grep adapter coverage
pankaj4u4m May 18, 2026
7903f6f
feat(02-01): add ast-grep infra adapter seam
pankaj4u4m May 18, 2026
3787d80
test(02-01): add failing code pattern gateway coverage
pankaj4u4m May 18, 2026
4123d83
feat(02-01): route code pattern requests through engine
pankaj4u4m May 18, 2026
469f939
feat(02-01): add structural pattern benchmark coverage
pankaj4u4m May 18, 2026
f380afd
fix(02-01): satisfy ast-grep validation gates
pankaj4u4m May 18, 2026
7a07bba
docs(phase-02): update tracking after wave 1
pankaj4u4m May 18, 2026
248f243
test(02-02): add failing cache freeze diagnostics coverage
pankaj4u4m May 18, 2026
c207a58
feat(02-02): freeze cache diagnostics and budget defaults
pankaj4u4m May 18, 2026
62e96f8
feat(02-02): add M12 partial-close benchmark evidence
pankaj4u4m May 18, 2026
5ab8bf4
fix(02-02): satisfy cache freeze validation gates
pankaj4u4m May 18, 2026
63b0524
docs(phase-02): update tracking after wave 2
pankaj4u4m May 18, 2026
c263ead
feat(02-03): add symbol edit seam
pankaj4u4m May 19, 2026
3e33062
feat(02-03): add symbol edit benchmark evidence
pankaj4u4m May 19, 2026
46d1897
docs(phase-02): update tracking after wave 3
pankaj4u4m May 19, 2026
2dd3327
feat(02-04): add routed usages workflow
pankaj4u4m May 19, 2026
4c4fdad
feat(02-04): add usages benchmark evidence
pankaj4u4m May 19, 2026
9da1698
docs(phase-02): update tracking after wave 4
pankaj4u4m May 19, 2026
b8fa606
feat(permissions): manage Atelier MCP tools in permissions.allow duri…
pankaj4u4m May 19, 2026
fe5d700
fix(phase-02): expose cache hit rate telemetry
pankaj4u4m May 19, 2026
49f41f7
docs(phase-02): record verification state
pankaj4u4m May 19, 2026
32b4024
docs(phase-02): complete phase closeout
pankaj4u4m May 19, 2026
6f4137f
docs(phase-03): plan semantic recall phase
pankaj4u4m May 19, 2026
f037f66
test(03-01): add failing semantic search engine coverage
pankaj4u4m May 19, 2026
c83e9c6
feat(03-01): add semantic ranking helper for code search
pankaj4u4m May 19, 2026
16ce1ef
test(03-01): add failing MCP mode-aware search coverage
pankaj4u4m May 19, 2026
16524bb
feat(03-01): wire search mode through MCP code surface
pankaj4u4m May 19, 2026
64b3345
test(03-01): add semantic search benchmark evidence
pankaj4u4m May 19, 2026
7e27b94
fix(03-01): satisfy semantic ranking lint and type gates
pankaj4u4m May 19, 2026
9f25b25
docs(03-01): complete semantic search ranking plan
pankaj4u4m May 19, 2026
86c7e49
test(03-02): add failing symbol recall helper coverage
pankaj4u4m May 19, 2026
f540a6d
feat(03-02): add symbol-linked recall bundle helper
pankaj4u4m May 19, 2026
d6bde79
test(03-02): add failing MCP recall_symbol coverage
pankaj4u4m May 19, 2026
ef2cb9f
feat(03-02): wire recall_symbol through memory MCP surface
pankaj4u4m May 19, 2026
b26cff3
feat(03-02): add recall_symbol benchmark evidence
pankaj4u4m May 19, 2026
d611d30
docs(03-02): complete symbol recall plan
pankaj4u4m May 19, 2026
fb882c2
test(03-03): add failing routed call graph provider coverage
pankaj4u4m May 19, 2026
9dd2cb9
feat(03-03): extend routed SCIP call edge contracts
pankaj4u4m May 19, 2026
5465683
test(03-03): add failing callers and callees MCP coverage
pankaj4u4m May 19, 2026
47c9a09
feat(03-03): add callers and callees code tool wrappers
pankaj4u4m May 19, 2026
f498c48
feat(03-03): add call graph benchmark evidence
pankaj4u4m May 19, 2026
f7fa64c
docs(03-03): complete call graph traversal plan
pankaj4u4m May 19, 2026
8db3eb7
fix(phase-03): satisfy recall symbol type gate
pankaj4u4m May 19, 2026
99b53ad
docs(phase-03): record verification state
pankaj4u4m May 19, 2026
700c7ea
docs(phase-03): complete phase closeout
pankaj4u4m May 19, 2026
7b92b48
docs(phase-04): plan historical intelligence
pankaj4u4m May 19, 2026
ae2d074
test(04-01): add failing bootstrap coverage
pankaj4u4m May 19, 2026
0538f31
feat(04-01): bootstrap pygit2 for git history
pankaj4u4m May 19, 2026
1e2d6aa
test(04-01): add failing git-history substrate coverage
pankaj4u4m May 19, 2026
af926a5
feat(04-01): build git-history graveyard substrate
pankaj4u4m May 19, 2026
79814fb
docs(04-01): complete historical code bootstrap plan
pankaj4u4m May 19, 2026
45a9854
test(04-02): add failing deleted-history engine coverage
pankaj4u4m May 19, 2026
2decbd6
feat(04-02): wire deleted-history search through engine
pankaj4u4m May 19, 2026
7b525c4
test(04-02): add failing deleted-history MCP coverage
pankaj4u4m May 19, 2026
dfc601b
feat(04-02): expose deleted-history search on code tool
pankaj4u4m May 19, 2026
22989b9
feat(04-02): add graveyard benchmark closeout evidence
pankaj4u4m May 19, 2026
b7f70e0
fix(04-02): correct M14 validation trace command
pankaj4u4m May 19, 2026
f67bb93
docs(04-02): complete deleted-history search plan
pankaj4u4m May 19, 2026
3a7d36e
test(04-03): add failing tests for blame substrate
pankaj4u4m May 19, 2026
9085d40
feat(04-03): add blame and churn substrate
pankaj4u4m May 19, 2026
70d5851
test(04-03): add failing freshness metadata tests
pankaj4u4m May 19, 2026
b9ae1e1
feat(04-03): propagate scip freshness metadata
pankaj4u4m May 19, 2026
2f7e425
docs(04-03): complete blame freshness substrate plan
pankaj4u4m May 19, 2026
b5a2022
test(04-04): add failing engine blame orchestration tests
pankaj4u4m May 19, 2026
3898800
feat(04-04): orchestrate blame and live temporal filtering
pankaj4u4m May 19, 2026
2f755f7
test(04-04): add failing MCP blame surface tests
pankaj4u4m May 19, 2026
14534e3
feat(04-04): add additive MCP blame dispatch
pankaj4u4m May 19, 2026
c63939c
feat(04-04): add M15 benchmark and cost evidence
pankaj4u4m May 19, 2026
695d66f
fix(04-04): restore lint compliance for wave4 artifacts
pankaj4u4m May 19, 2026
d9ca25a
docs(04-04): complete blame temporal closeout plan
pankaj4u4m May 19, 2026
8fa8629
fix(phase-04): restore historical typing
pankaj4u4m May 19, 2026
5553b90
docs(phase-04): record verification state
pankaj4u4m May 19, 2026
2c2a2e5
docs(phase-04): complete phase closeout
pankaj4u4m May 19, 2026
fba83a2
docs(phase-05): plan scale reach phase
pankaj4u4m May 19, 2026
9988265
feat(phase-03): adaptive vendor intelligence + team/governance/audit
pankaj4u4m May 19, 2026
8cd5962
chore: remove patch backup file
pankaj4u4m May 19, 2026
83263cc
test(05-01): add failing M18 rubric tests
pankaj4u4m May 19, 2026
90d064e
feat(05-01): add executable M18 rubric harness
pankaj4u4m May 19, 2026
cb53100
test(05-01): add failing M18 memo rendering tests
pankaj4u4m May 19, 2026
9aebc57
feat(05-01): complete M18 checkpoint memo
pankaj4u4m May 19, 2026
009a7d5
docs(05-01): record M18 checkpoint state
pankaj4u4m May 19, 2026
b1814e9
docs(05-01): ratify M18 checkpoint option-a
pankaj4u4m May 19, 2026
f54386b
docs(05-01): complete M18 checkpoint closeout
pankaj4u4m May 19, 2026
6498440
test(05-03): add failing cross-language edge store tests
pankaj4u4m May 19, 2026
7258e83
feat(05-03): add literal-only cross-language edge storage
pankaj4u4m May 19, 2026
8bd8f75
test(05-03): add failing resolver and hydration tests
pankaj4u4m May 19, 2026
9fcf463
feat(05-03): add literal-only cross-language hydration
pankaj4u4m May 19, 2026
7065bd5
feat(05-03): add cross-language benchmark smoke
pankaj4u4m May 19, 2026
f5d7f69
docs(05-03): complete M17 cross-language plan
pankaj4u4m May 19, 2026
f3a5823
test(05-02): add failing zoekt runtime seam tests
pankaj4u4m May 19, 2026
390b075
feat(05-02): add zoekt runtime seam
pankaj4u4m May 19, 2026
ae96018
test(05-02): add failing zoekt search routing coverage
pankaj4u4m May 19, 2026
8e4e51d
feat(05-02): route large search workloads through zoekt
pankaj4u4m May 19, 2026
3d71881
feat(05-02): add zoekt benchmark evidence
pankaj4u4m May 19, 2026
aff49cd
docs(05-02): complete validated zoekt routing plan
pankaj4u4m May 19, 2026
e949983
fix(phase-05): bootstrap zoekt by default
pankaj4u4m May 19, 2026
073ea40
fix(phase-05): use real zoekt runtime
pankaj4u4m May 19, 2026
0ba226d
docs(phase-05): record verification state
pankaj4u4m May 19, 2026
3ccf17d
docs(phase-05): complete phase closeout
pankaj4u4m May 19, 2026
1a1d261
docs(phase-06): plan execution
pankaj4u4m May 19, 2026
3dcacca
test(06-01): add failing bootstrap context tests
pankaj4u4m May 19, 2026
7b394d2
feat(06-01): add deterministic bootstrap context planner
pankaj4u4m May 19, 2026
a2dc98f
test(06-01): add failing bootstrap enqueue tests
pankaj4u4m May 19, 2026
a8e729f
feat(06-01): wire bootstrap jobs into context flow
pankaj4u4m May 19, 2026
8a90a38
feat(06-01): add bootstrap warm-path benchmark evidence
pankaj4u4m May 19, 2026
e2f450c
fix(06-01): keep bootstrap bench output off the repo root
pankaj4u4m May 19, 2026
4af3467
docs(06-01): complete bootstrap prefetch plan
pankaj4u4m May 19, 2026
000343d
test(06-02): add failing external SCIP origin tests
pankaj4u4m May 19, 2026
ede3db0
feat(06-02): add external SCIP artifact discovery
pankaj4u4m May 19, 2026
4b4884b
test(06-02): add failing external scope routing tests
pankaj4u4m May 19, 2026
ba32c80
feat(06-02): route external scope and block dependency edits
pankaj4u4m May 19, 2026
4158850
feat(06-02): add external scope benchmark evidence
pankaj4u4m May 19, 2026
7a97ff4
docs(06-02): complete external dependency scope plan
pankaj4u4m May 19, 2026
9e7a8c8
test(06-03): add failing workspace routing tests
pankaj4u4m May 19, 2026
e5ab19d
feat(06-03): add workspace config and router layer
pankaj4u4m May 19, 2026
e1a816b
test(06-03): add failing workspace code tool tests
pankaj4u4m May 19, 2026
013e47d
feat(06-03): route workspace code ops with repo metadata
pankaj4u4m May 19, 2026
f9da91d
feat(06-03): add workspace routing benchmark evidence
pankaj4u4m May 19, 2026
c3771d3
docs(06-03): complete multi-repo workspace plan
pankaj4u4m May 19, 2026
3a37d8f
docs(phase-06): record verification state
pankaj4u4m May 19, 2026
5f8813e
docs(phase-06): mark approval pending
pankaj4u4m May 19, 2026
b9964ce
fix(frontend): point VITE_API_URL to service host in docker-compose
pankaj4u4m May 20, 2026
9afeb93
feat(benchmarks): add core benchmark runner for MCP vs builtin tools
pankaj4u4m May 21, 2026
53b9ea2
feat: Integrate Antigravity support into Atelier
pankaj4u4m May 22, 2026
6c6e794
Refactor CLI commands and scripts to unify status command
pankaj4u4m May 22, 2026
417cbed
Add tests for OpenMemory integration and enhance trace record handling
pankaj4u4m May 22, 2026
f31be06
Potential fix for pull request finding 'CodeQL / Incomplete URL subst…
pankaj4u4m May 22, 2026
87fa3eb
Potential fix for pull request finding 'CodeQL / Clear-text storage o…
pankaj4u4m May 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ATELIER_REQUIRE_AUTH=true
ATELIER_API_KEY=replace-me
ATELIER_SERVICE_URL=http://atelier:8787
ATELIER_MCP_MODE=remote
ATELIER_OPENMEMORY_ENABLED=false
ATELIER_OPENMEMORY_MCP_SERVER_NAME=openmemory
ATELIER_LESSON_PR_BOT_ENABLED=false
GITHUB_TOKEN=
Expand Down
2 changes: 1 addition & 1 deletion .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo "📍 Checking Pushing $CURRENT_BRANCH to $REMOTE_BRANCH"
# Skip session import + external reports — those are slow, code-independent, and
# covered by tests; only host integrations need to be verified at push time.
echo "🛠️ Running make install (host integrations only)..."
if ! ATELIER_NO_IMPORT=1 ATELIER_STRICT=1 make install; then
if ! ATELIER_STRICT=1 make install; then
echo -e "\033[1;31m❌ make install failed. Push blocked.\033[0m"
echo " Fix the install error locally or use 'git push --no-verify' if you intentionally need to bypass the hook."
exit 1
Expand Down
46 changes: 46 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
applyTo: "**"
---

<!-- Generated by `scripts/sync_agent_context.py`. Edit `../docs/agent-os/README.md` and rerun the generator. -->


## Tool substitution — mandatory

| Use this | Instead of | Why |
|---|---|---|
| `mcp__atelier__read` | `Read` / `Bash(cat ...)` | outline-first, 80-95% fewer tokens on large files |
| `mcp__atelier__search` | `Grep` / `Glob` / `Bash(grep/rg ...)` | ranked, budget-capped, ~280k tokens saved vs naive scan |
| `mcp__atelier__edit` | `Edit` / `Write` | atomic multi-file, snapshot/rollback, diff recorded |
| `mcp__atelier__shell` | `Bash(...)` | ANSI-stripped, line-truncated, token-compact |
| `mcp__atelier__code op=search` | `Bash(grep -rn symbol ...)` | SCIP-indexed, zero subprocess cost |

**Bash is only for git commands and process management.** Do NOT use `Bash(cat file)`, `Bash(grep ...)`, or `Bash(find ...)` — use the atelier equivalents above.

Treat this file as a thin entrypoint. The live source of truth is:

- [Agent OS](../docs/agent-os/README.md)
- [Workflow](../docs/agent-os/workflow.md)
- [Taste invariants](../docs/agent-os/taste-invariants.md)
- [Validation matrix](../docs/agent-os/validation-matrix.md)
- [Architecture](../docs/architecture/README.md)
- [Quality scorecard](../docs/quality/scorecard.md)
- [Plans](../docs/plans/README.md)
- [Decisions](../docs/decisions/README.md)

## Budget optimizer

- Before changing files, name the deliverable and summarize the smallest viable plan.
- Keep context narrow: use only the current goal, relevant files, failing command/output, and known constraints.
- Restate working context in under 10 bullets before editing or after compaction.
- If more than 10 minutes pass without an edit, name the expected deliverable or check with the user.
- If the same approach fails twice, call `rescue` or change approach; do not retry a third time.

## Native fallback

If an Atelier MCP tool returns `noop`, is hidden, or is unavailable, use Copilot or VS Code native file reads, workspace search, shell `rg`, or `grep`.
Always return findings instead of waiting for tool availability to improve.

## Validation

See [Validation matrix](../docs/agent-os/validation-matrix.md) for the minimum checks by change surface. Use the VS Code tasks for repeatable preflight, worktree, and runtime evidence loops.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ coverage.xml
# Claude Code
.codex/
.claude/
.antigravity/
.antigravitycli/

# Claude Desktop
.claude/
Expand All @@ -68,9 +70,8 @@ coverage.xml
# Gemini CLI
.gemini/

# Github copilot (generated by install, not source)
.github/copilot-instructions.md*
.github/chatmodes/
# Github copilot workspace backups
.github/copilot-instructions.md.atelier-backup.*

# VSCode test
.vscode-test/
Expand Down Expand Up @@ -141,6 +142,7 @@ results/
*.sql
!src/**/*.sql
*.sqlite3
vector_cache.sqlite
dump.rdb
*.rdb

Expand Down
40 changes: 40 additions & 0 deletions .knowledge/blocks/canonical-identifier-over-display-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Canonical Identifier Over Display Name

- **id:** `canonical-identifier-over-display-name`
- **domain:** `state.change`
- **status:** `active`
- **task_types:** integration_change, data_write, rollback

## Situation
Human-readable labels such as titles, URLs, paths, and display names can drift. Mutations and rollbacks should target a stable canonical identifier.


## Triggers
- slug
- handle
- title
- url

## Dead ends
- resolve target from url slug alone
- use display name as stable identity

## Procedure
1. Resolve the target through its canonical stable identifier.
2. Record that identifier before the write.
3. Use the same identifier for the mutation and the readback.

## Verification
- A canonical identifier was recorded before the write.
- The same identifier was used for readback.

## Failure signals
- wrong target updated
- ambiguous match set

## When not to apply
Pure read-only exploration where no state mutation or rollback will happen.


## Scope
- tool_patterns: api.write, db.write
11 changes: 11 additions & 0 deletions .knowledge/blocks/coding-custom-my-custom-block-5e17f4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# My Custom Block

- **id:** `coding-custom-my-custom-block-5e17f4`
- **domain:** `coding.custom`
- **status:** `active`

## Situation
Use this when a custom situation arises

## Procedure
1. Do the thing
19 changes: 19 additions & 0 deletions .knowledge/blocks/rb-runtime-learned.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Runtime Learned Recovery

- **id:** `rb-runtime-learned`
- **domain:** `Agent.shopify.publish`
- **status:** `active`

## Situation
When runtime traces show repeated publish failures

## Triggers
- publish
- shopify

## Dead ends
- Retry blindly without validating identifiers

## Procedure
1. Confirm Product GID
2. Run validation before retry
38 changes: 38 additions & 0 deletions .knowledge/blocks/template_alembic-migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: template-python-fastapi-alembic-migrations
title: Alembic Migration Discipline
domain: coding.python-fastapi
task_types:
- feature
- refactor
triggers:
- Alembic migration
- database schema change
- SQLAlchemy model change
file_patterns:
- "**/alembic/**/*.py"
- "**/migrations/**/*.py"
- "**/models.py"
tool_patterns:
- alembic
situation: "A code change adds, removes, renames, or changes persistence fields. TODO: replace with your migration review checklist."
dead_ends:
- "Changing ORM models without a matching migration."
- "Using autogenerated migration output without reviewing indexes, defaults, and data backfills."
procedure:
- "Create a migration in the same change as the model update."
- "Review autogenerated operations for destructive changes and explicit server defaults."
- "Keep data backfills idempotent or split them from schema-only migrations when needed."
- "Document any manual deployment ordering in the migration or PR description."
verification:
- "Run Alembic upgrade on a clean database."
- "Run Alembic downgrade when the project requires reversible migrations."
- "Run tests that exercise the changed model fields."
failure_signals:
- "Runtime model expects a column that the migration does not create."
- "Migration drops or renames data without an explicit review note."
required_rubrics: []
when_not_to_apply: "Read-only query changes that do not alter persisted schema."
---

TODO: Add your production rollback expectations before using this block unchanged.
35 changes: 35 additions & 0 deletions .knowledge/blocks/template_dependency-injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: template-python-fastapi-dependency-injection
title: FastAPI Dependency Injection Boundaries
domain: coding.python-fastapi
task_types:
- feature
- refactor
triggers:
- Depends
- request scoped dependency
- database session
file_patterns:
- "**/api/**/*.py"
- "**/dependencies.py"
tool_patterns: []
situation: "A route, service, or test needs access to request-scoped resources such as sessions, auth principals, config, or clients. TODO: document your approved dependency names."
dead_ends:
- "Creating database sessions or network clients directly inside route handlers."
- "Using module-level mutable singletons for request-scoped state."
procedure:
- "Expose request-scoped resources through small FastAPI dependency functions."
- "Keep dependencies composable: authentication, session, and external clients should be separately overrideable in tests."
- "Use dependency_overrides in tests instead of monkeypatching global state."
- "Close or yield-clean up resources in the dependency that created them."
verification:
- "Run tests that override the dependency and prove the route uses the override."
- "Check that resources created by yield dependencies are cleaned up after requests."
failure_signals:
- "Tests need network access because dependencies cannot be overridden."
- "Connection/session lifecycle is hidden in route code."
required_rubrics: []
when_not_to_apply: "Simple pure functions that do not depend on request state or external resources."
---

TODO: Add company-specific dependency override examples here.
35 changes: 35 additions & 0 deletions .knowledge/blocks/template_pydantic-api-boundaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: template-python-fastapi-pydantic-api-boundaries
title: Pydantic Models At API Boundaries
domain: coding.python-fastapi
task_types:
- feature
- refactor
triggers:
- FastAPI request model
- Pydantic response model
- API schema change
file_patterns:
- "**/api/**/*.py"
- "**/schemas.py"
tool_patterns: []
situation: "A FastAPI endpoint accepts or returns structured data. TODO: adapt examples to your service naming conventions."
dead_ends:
- "Returning raw ORM objects directly from handlers."
- "Letting dictionaries drift without a Pydantic schema."
procedure:
- "Define explicit Pydantic request and response models for the endpoint boundary."
- "Keep persistence models separate from public API models unless the team has approved coupling."
- "Set response_model on the route and verify optional/null fields match the public contract."
- "When changing a model, update OpenAPI snapshots or schema tests if the repo has them."
verification:
- "Run the endpoint tests that exercise serialization and validation failures."
- "Inspect the generated OpenAPI schema for changed public fields."
failure_signals:
- "Response contains private database fields."
- "422 behavior changes without an explicit test."
required_rubrics: []
when_not_to_apply: "Pure internal helper changes that do not cross the API boundary."
---

TODO: Replace this note with examples from your service once the template is adopted.
36 changes: 36 additions & 0 deletions .knowledge/blocks/template_pytest-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
id: template-python-fastapi-pytest-layout
title: Pytest Layout For FastAPI Services
domain: coding.python-fastapi
task_types:
- test
- feature
triggers:
- FastAPI test client
- pytest fixture
- endpoint test
file_patterns:
- "tests/**/*.py"
- "**/conftest.py"
tool_patterns:
- pytest
situation: "A change adds or updates tests around FastAPI routes, dependencies, or service behavior. TODO: align fixture names with your repository."
dead_ends:
- "Sharing mutable fixture state across tests without reset."
- "Testing route internals instead of public request/response behavior."
procedure:
- "Use a client fixture or factory that applies dependency overrides explicitly."
- "Keep database fixtures isolated per test or roll them back predictably."
- "Assert status codes and response bodies for both success and validation failure paths."
- "Prefer narrow service fixtures over large app-wide fixtures when the endpoint is not under test."
verification:
- "Run the focused test file first, then the broader API test subset."
- "Confirm test order does not affect the result."
failure_signals:
- "Tests pass alone but fail when the whole suite runs."
- "Fixture setup performs real external calls."
required_rubrics: []
when_not_to_apply: "Unit tests for pure functions that do not need the app or test client."
---

TODO: Link to your preferred test command and fixture naming standard.
38 changes: 38 additions & 0 deletions .knowledge/blocks/template_request-tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: template-python-fastapi-request-tracing
title: Request Tracing And Correlation IDs
domain: coding.python-fastapi
task_types:
- feature
- debug
- ops
triggers:
- correlation ID
- request ID
- tracing
- middleware
file_patterns:
- "**/middleware*.py"
- "**/api/**/*.py"
- "**/*.py"
tool_patterns: []
situation: "A request path, middleware, or downstream client needs traceability across service boundaries. TODO: name your canonical header and trace field."
dead_ends:
- "Generating a new request ID when a trusted upstream ID already exists."
- "Dropping correlation IDs before downstream calls or background jobs."
procedure:
- "Read the approved inbound correlation header or create one at the service edge."
- "Attach the ID to request-local context used by logs and errors."
- "Propagate the ID to approved downstream calls and background tasks."
- "Return or expose the ID according to the service's debugging policy."
verification:
- "Test requests with and without an inbound correlation ID."
- "Inspect logs or response headers to confirm the same ID is preserved."
failure_signals:
- "A single user request produces unrelated IDs across logs."
- "Background work cannot be tied back to the originating request."
required_rubrics: []
when_not_to_apply: "Offline scripts and one-shot migrations that do not handle service requests."
---

TODO: Add your trace header name and any privacy constraints.
39 changes: 39 additions & 0 deletions .knowledge/blocks/template_ruff-black-formatting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: template-python-fastapi-ruff-black-formatting
title: Ruff And Black Formatting Gate
domain: coding.python-fastapi
task_types:
- feature
- refactor
- test
triggers:
- Ruff
- Black
- formatting
- lint
file_patterns:
- "**/*.py"
- "pyproject.toml"
tool_patterns:
- ruff
- black
situation: "A Python code change is ready for validation. TODO: replace command examples with your repo's make targets."
dead_ends:
- "Declaring completion before local formatting/lint checks run."
- "Hand-formatting around a formatter instead of using the configured tools."
procedure:
- "Run the repository's formatter command or Black-compatible target."
- "Run Ruff linting on the touched files or project subset."
- "Fix reported issues in source rather than suppressing rules casually."
- "If a suppression is necessary, keep it narrow and explain it in code review."
verification:
- "Confirm formatter reports no diff."
- "Confirm Ruff exits successfully on the touched files or documented subset."
failure_signals:
- "CI formatting check changes files after the agent reports done."
- "A broad noqa or per-file ignore hides unrelated issues."
required_rubrics: []
when_not_to_apply: "Documentation-only changes with no Python source edits."
---

TODO: Add your exact lint and format commands.
Loading
Loading