axiom-coding-agent-setup 1.0.11 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.agents/CONTEXT-MANAGEMENT.md +155 -0
  2. package/.agents/DEBUGGING.md +124 -0
  3. package/.agents/{engineering.md → ENGINEERING.md} +6 -0
  4. package/.agents/PERFORMANCE.md +164 -0
  5. package/.agents/SECURITY.md +109 -0
  6. package/.agents/{workflow.md → WORKFLOW.md} +7 -1
  7. package/.agents/skills/project-design/SKILL.md +207 -0
  8. package/.agents/skills/project-design/references/ARCHITECTURE.md +641 -0
  9. package/.agents/skills/project-design/references/PROJECT_PLAN.md +316 -0
  10. package/.agents/skills/skill-creator/LICENSE.txt +202 -0
  11. package/.agents/skills/skill-creator/SKILL.md +485 -0
  12. package/.agents/skills/skill-creator/agents/analyzer.md +274 -0
  13. package/.agents/skills/skill-creator/agents/comparator.md +202 -0
  14. package/.agents/skills/skill-creator/agents/grader.md +223 -0
  15. package/.agents/skills/skill-creator/assets/eval_review.html +146 -0
  16. package/.agents/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  17. package/.agents/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  18. package/.agents/skills/skill-creator/references/schemas.md +430 -0
  19. package/.agents/skills/skill-creator/scripts/__init__.py +0 -0
  20. package/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  21. package/.agents/skills/skill-creator/scripts/generate_report.py +326 -0
  22. package/.agents/skills/skill-creator/scripts/improve_description.py +247 -0
  23. package/.agents/skills/skill-creator/scripts/package_skill.py +136 -0
  24. package/.agents/skills/skill-creator/scripts/quick_validate.py +103 -0
  25. package/.agents/skills/skill-creator/scripts/run_eval.py +310 -0
  26. package/.agents/skills/skill-creator/scripts/run_loop.py +328 -0
  27. package/.agents/skills/skill-creator/scripts/utils.py +47 -0
  28. package/AGENTS.md +68 -4
  29. package/README.md +42 -6
  30. package/bin/cli.js +15 -6
  31. package/package.json +1 -1
  32. package/plugin/oh-my-openagent.json +198 -0
  33. package/plugin/oh-my-openagent.md +49 -0
  34. package/skills-lock.json +6 -0
  35. /package/.agents/{stack.md → STACK.md} +0 -0
@@ -0,0 +1,316 @@
1
+ # AdaptiveRAG — Project Plan & Progress Tracker
2
+
3
+ > Master checklist for the entire build. Update status markers as work completes. See `ARCHITECTURE.md` for design rationale.
4
+
5
+ **Status legend:** ✅ done · 🚧 in progress · ⬜ pending · ⏸️ deferred · ❌ cancelled
6
+
7
+ ---
8
+
9
+ ## Phase 0 — Project Setup ✅
10
+
11
+ - Repo initialized (`.git`, `.gitignore`, `.gitattributes`)
12
+ - Python 3.14 + `uv` package manager
13
+ - `pyproject.toml` with core deps
14
+ - `.env` for API keys (`OPENAI_API_KEY`, `QWEN_API_KEY`)
15
+ - `AGENTS.md` engineering principles
16
+ - `ARCHITECTURE.md` system design
17
+ - `PROJECT_PLAN.md` (this file)
18
+ - `.env.example` template
19
+
20
+ ---
21
+
22
+ ## Phase 1 — Document → Markdown (Docling baseline) ✅
23
+
24
+ **Goal:** Upload a document, get clean markdown back. Docling-only.
25
+
26
+ - `src/core/file_detector.py` — extension/MIME detection
27
+ - `src/core/converter.py` — Docling wrapper
28
+ - `src/ui/markdown_converter_ui.py` — Gradio upload/preview/download UI
29
+ - `app.py` — entry point
30
+ - Docling model warm-up on startup
31
+
32
+ **Acceptance:** Upload PDF/DOCX/PPTX, see markdown rendered, download `.md` file.
33
+
34
+ ---
35
+
36
+ ## Phase 2 — Parser Router + Qwen3-VL OCR Fallback 🚧
37
+
38
+ **Goal:** Route per-file-type. Use Docling for digital formats, Qwen3-VL for images and scanned PDFs. Add caching so iteration doesn't burn API credits.
39
+
40
+ ### Cleanup
41
+
42
+ - Trim `file_detector.py` to common formats only (drop ASCIIDOC, LaTeX, XML, JSON, audio/video, VTT, BMP, TIFF, format variants like `.dotx`/`.docm`/etc.)
43
+
44
+ ### New modules
45
+
46
+ - `src/utils/pdf_inspector.py`
47
+ - `is_scanned_pdf(path) -> bool` heuristic (sample first 3 pages, threshold by extracted text length)
48
+ - `render_pdf_pages(path, dpi=150) -> Iterator[bytes]` (PNG bytes via `pypdfium2`)
49
+ - `src/cache/ocr_cache.py` — SHA256-keyed disk cache for OCR results
50
+ - `src/core/qwen_parser.py`
51
+ - `QwenParser.extract_image(path) -> str`
52
+ - `QwenParser.extract_pdf_pages(path) -> str` (per-page caching, concat)
53
+ - Tenacity retry on rate limits / network errors
54
+ - Deterministic OCR prompt
55
+ - `src/core/docling_parser.py` — Docling-only parser (extracted from `converter.py`)
56
+ - `src/core/parser_router.py` — dispatches:
57
+ ```
58
+ .md / .txt → passthrough (read file)
59
+ .png / .jpg / .webp → Qwen
60
+ .pdf scanned → Qwen (per page, cached)
61
+ .pdf born-digital → Docling
62
+ .docx / .pptx / .xlsx / .html / .csv → Docling
63
+ ```
64
+
65
+ ### Refactor
66
+
67
+ - `src/core/converter.py` — slim down to public API, delegate to `parser_router`
68
+ - `src/core/__init__.py` — update exports
69
+
70
+ ### UI
71
+
72
+ - Toggle: "Force Qwen3-VL OCR for PDFs" (override born-digital heuristic)
73
+ - Progress indicator for multi-page scanned PDFs
74
+ - Show parser used (`docling` / `qwen3-vl` / `passthrough`) in status
75
+
76
+ ### Dependencies
77
+
78
+ - Add `pypdfium2>=4.30` (PDF inspection + rendering)
79
+ - Add `tenacity>=9.0` (retry)
80
+ - Add `pillow>=10` (PIL image handling — also Docling transitive but pin explicit)
81
+
82
+ **Acceptance:**
83
+
84
+ 1. Upload a born-digital PDF → routes to Docling → markdown returned in seconds.
85
+ 2. Upload a scanned PDF → routes to Qwen → markdown with preserved tables.
86
+ 3. Upload a `.png` of a table → routes to Qwen → markdown table.
87
+ 4. Re-upload same file → returns from cache (< 100ms, no API call).
88
+ 5. Upload `.docx` / `.pptx` / `.xlsx` / `.html` → Docling, no Qwen call.
89
+ 6. Upload `.md` / `.txt` → passthrough, instant.
90
+
91
+ ---
92
+
93
+ ## Phase 3 — Chunking + Indexing ✅
94
+
95
+ **Goal:** Header-aware chunking + hybrid (dense + BM25) indexing in Qdrant.
96
+
97
+ ### Modules
98
+
99
+ - `src/chunking/markdown_chunker.py`
100
+ - `MarkdownHeaderTextSplitter` primary split (`#`/`##`/`###`, `strip_headers=False`)
101
+ - `RecursiveCharacterTextSplitter` fallback for oversized sections (>1500 chars)
102
+ - Inject `header_path`, `doc_id`, `chunk_index`, `total_chunks`, `parser`, `pages` into metadata
103
+ - `src/chunking/metadata.py` — content-hash `doc_id`, deterministic `chunk_uuid` (UUID5), ingestion timestamp
104
+ - `src/indexing/embeddings.py` — dense (`text-embedding-3-small`, cached) + sparse (FastEmbed `Qdrant/bm25`)
105
+ - `src/indexing/qdrant_store.py` — hybrid collection (named vectors + IDF modifier), upsert, doc-level dedup, library listing, delete-by-doc
106
+ - Deduplication is part of `QdrantStore` (skip / replace / count-by-doc) — no separate module needed
107
+ - `src/cache/embedding_cache.py` — wraps OpenAI embeddings with `CacheBackedEmbeddings` + `LocalFileStore`
108
+ - `src/indexing/pipeline.py` — convert → chunk → upsert orchestrator
109
+
110
+ ### Infrastructure
111
+
112
+ - `docker-compose.yml` with Qdrant (REST 6333 + gRPC 6334)
113
+ - `scripts/init_qdrant.py` — verifies/creates collection, supports `--recreate`
114
+
115
+ ### Dependencies
116
+
117
+ - Added `qdrant-client>=1.12`
118
+ - Added `fastembed>=0.4.2`
119
+
120
+ ### UI
121
+
122
+ - Refactored `src/ui` into tab-based composition (`main_ui.py`)
123
+ - New tab: **Ingest** — multi-file upload → convert → chunk → index, with library table, refresh, and delete-by-doc-id
124
+
125
+ **Acceptance:**
126
+
127
+ 1. Upload doc → indexed with N chunks. ✅
128
+ 2. Re-upload same doc → replaces by default (UUID5 deterministic IDs); checkbox flips to skip-if-exists. ✅
129
+ 3. Qdrant has both dense + sparse vectors per chunk (named vectors). ✅
130
+ 4. Each chunk has `header_path` metadata visible (e.g. `"Refund Policy > Eligibility"`). ✅
131
+
132
+ **Known limitation:** `py-rust-stemmers` 0.1.5 segfaults on Python 3.14
133
+ ([qdrant/py-rust-stemmers#9](https://github.com/qdrant/py-rust-stemmers/pull/9)).
134
+ We pass `disable_stemmer=True` to FastEmbed BM25 as a workaround. Drop the
135
+ flag in `src/indexing/embeddings.py::build_sparse_embeddings` once a fixed
136
+ release is published. Quality impact is small (only stemming-sensitive
137
+ queries like "running"/"runs" are affected).
138
+
139
+ ---
140
+
141
+ ## Phase 4 — Hybrid Retrieval + Reranker + Basic Chat ✅
142
+
143
+ **Goal:** Ask questions, get answers grounded in indexed docs.
144
+
145
+ ### Modules
146
+
147
+ - `src/config/settings.py` — single source of truth for tunables (top-K, models, temperature, etc.) — overridable via `.env`
148
+ - `src/retrieval/hybrid_search.py` — `HybridRetriever` (Qdrant `similarity_search_with_score` over the named-vector hybrid collection — server-side RRF fusion) + `RetrievalPipeline` (prefetch → rerank → trim) with `RetrievedChunk` + `RetrievalReport` dataclasses
149
+ - `src/retrieval/reranker.py` — FlashRank ONNX cross-encoder wrapper (`ms-marco-MiniLM-L-12-v2` default, ~34 MB), graceful fallback if unavailable
150
+ - Citations live next to retrieval (`RetrievedChunk.citation_label()`) — no dedicated `citations.py` module needed
151
+ - `src/synthesis/response.py` — `GroundedAnswerer` builds a numbered-context prompt, calls `ChatOpenAI`, parses inline `[n]` citations into `Citation` objects
152
+ - `src/ui/chat_ui.py` — Chatbot + textbox + sources panel + per-turn debug strip; lazy init for retrieval/reranker/LLM so the tab opens fast
153
+
154
+ ### Refactor
155
+
156
+ - Migrated existing modules (`indexing/embeddings.py`, `indexing/qdrant_store.py`, `chunking/markdown_chunker.py`, `core/qwen_parser.py`) to read defaults from `src.config.settings` instead of duplicated env reads / hardcoded constants
157
+ - Reordered tabs (`Chat → Ingest → Convert`) so the primary workflow is front and center
158
+
159
+ ### Dependencies
160
+
161
+ - Added `flashrank>=0.2.9` (pure-ONNX reranker, no Torch — keeps Python 3.14 install clean)
162
+ - LLM via existing `langchain-openai` (`ChatOpenAI`, model defaults to `gpt-4.1-mini`)
163
+
164
+ ### UI
165
+
166
+ - New tab: **Chat** — `gr.Chatbot` + submit textbox, sources accordion, per-turn debug line (model · prefetch / rerank timings)
167
+
168
+ **Acceptance:**
169
+
170
+ 1. Query a document, get an answer with at least one citation. ✅
171
+ 2. Citation links back to the source chunk + filename + header path. ✅
172
+ 3. Configurable `RERANK_TOP_K` (default 5) and `RETRIEVAL_PREFETCH_K` (default 25) via `.env`. ✅
173
+ 4. Reranker reorders the hybrid candidates (verified against the indexed sample corpus). ✅
174
+
175
+ ### Deferred to Phase 6
176
+
177
+ - First Ragas baseline run (golden set + metrics) — moves with the other eval work in Phase 6 to keep this phase focused on the user-facing pipeline
178
+
179
+ ---
180
+
181
+ ## Phase 5 — Adaptive Query Router ✅
182
+
183
+ **Goal:** Implement actual Adaptive RAG. Pick `no_retrieval | vector_only | sql_only | hybrid | clarify` per query.
184
+
185
+ ### Routing layer
186
+
187
+ - `src/routing/strategies.py` — `Strategy` `StrEnum` + label / capability sets
188
+ - `src/routing/prompts.py` — router system prompt + few-shot examples + schema injection
189
+ - `src/routing/adaptive_router.py` — `ChatOpenAI(...).with_structured_output(RouterDecision)` classifier; passes chat history; sanitizes (downgrades SQL strategies if backend missing, fills missing clarify question)
190
+ - `src/routing/dispatcher.py` — `AdaptiveDispatcher` orchestrates router → retrieval → SQL → synthesis with per-stage timings, lazy backends, and graceful SQL fallback
191
+
192
+ ### Tools
193
+
194
+ - `src/tools/sql_tool.py` — schema introspection, NL→SQL via `with_structured_output(_SqlOutput)`, statement-level allowlist (only `SELECT`/`WITH`), forbidden-keyword regex, no-multi-statement guard, server-side `statement_timeout`, transaction-level `READ ONLY`, automatic `LIMIT N` injection
195
+ - `src/tools/registry.py` — **dropped on purpose.** With explicit routing → dispatch we don't need a function-calling registry abstraction; `SqlTool` is just a class. Documented in code comments / decision log.
196
+
197
+ ### Synthesis
198
+
199
+ - Extended `GroundedAnswerer` with `answer_direct(...)` (no_retrieval) and `answer_with_sql(...)` (sql_only / hybrid). Single citation model: `[1]..[N]` for chunks, `[DB]` for SQL — parsed back out into `AnswerResponse.cited_indices` / `cited_db`.
200
+
201
+ ### Demo data
202
+
203
+ - `scripts/seed_demo_data.py` — deterministic e-commerce dataset (100 customers, 50 products, 500 orders, ~1300 line items, ~35 refunds). Idempotent (skips if already populated) with `--recreate` flag. Creates a dedicated read-only role `adaptive_rag_ro` with `SELECT`-only grants for the app to use.
204
+
205
+ ### Infrastructure
206
+
207
+ - Postgres added to `docker-compose.yml` (`postgres:17-alpine`, healthcheck, persistent volume). **Bound to host port `5433`** (not `5432`) to dodge collisions with a host-installed Postgres.
208
+ - `.env.example` documents `SQL_DATABASE_URL`, `SQL_QUERY_TIMEOUT_SEC`, `SQL_ROW_LIMIT`, `ROUTER_MODEL`, `ROUTER_TEMPERATURE`, `SQL_MODEL`. All wired through `src.config.settings`.
209
+
210
+ ### Dependencies
211
+
212
+ - Added `sqlalchemy>=2.0.36`
213
+ - Added `psycopg[binary]>=3.2.3`
214
+ - Added explicit `pydantic>=2.9.0` (already a transitive dep, pinned for clarity)
215
+
216
+ ### UI
217
+
218
+ - Refactored `src/ui/chat_ui.py` to call `AdaptiveDispatcher`. Sources panel now shows: strategy badge + reasoning, executed SQL with first 5 result rows, and chunk citations. Per-turn debug strip shows per-stage timings.
219
+
220
+ **Acceptance:**
221
+
222
+ 1. ✅ "What does the indexed story say about the aliens arriving in Jakarta?" → `vector_only` (5 chunks retrieved, 5 cited, narrative answer).
223
+ 2. ✅ "How many refunds last 30 days?" → `sql_only` (`SELECT COUNT(*) FROM refunds WHERE created_at >= NOW() - INTERVAL '30 days'` → "3 refunds [DB]").
224
+ 3. ✅ "Summarize the indexed story and tell me total refunds in our database" → `hybrid` (chunks + SQL, blended answer).
225
+ 4. ✅ "Hi there!" → `no_retrieval`.
226
+ 5. ✅ "What about last quarter?" → `clarify` ("Could you specify what information about last quarter you're interested in — sales, refunds, new customers?").
227
+
228
+ ### Deferred to Phase 6
229
+
230
+ - Routing accuracy metric on a golden set (30-50 examples) — moves with the rest of the eval work.
231
+ - Top-N products SQL with `ORDER BY ... DESC` is correct, but synthesis truncates the list when the chunk slice cuts mid-list. Worth a small system-prompt tweak in Phase 6.
232
+
233
+ ### Known surprises (from smoke test)
234
+
235
+ - The router will pick `no_retrieval` over `vector_only` for vague conversational openers like "What happens in the story?" without prior turns — it asks "which story?" instead of blindly searching. Defensible behavior; document the workaround (be specific, e.g. "What does the indexed story say about X").
236
+
237
+ ---
238
+
239
+ ## Phase 6 — Evaluation, Tracing, Polish ✅
240
+
241
+ **Goal:** Make this presentable as a portfolio piece.
242
+
243
+ ### Observability (Langfuse)
244
+
245
+ - `src/observability/langfuse_client.py` — lazy singleton `Langfuse` client, no-op `span()` context manager when keys are missing, `CallbackHandler` factory for LangChain
246
+ - `src/observability/cost_tracker.py` — read-side helper that pulls daily metrics from Langfuse's `/api/public/metrics/daily` endpoint (no separate price table to maintain)
247
+ - `src/routing/dispatcher.py` — wraps every chat turn in a parent `chat.turn` span with child spans `router.classify`, `retrieval.hybrid_search`, `tool.sql_execute`, `synthesis.direct` / `synthesis.grounded`. Auto-flushes after each turn so traces appear immediately even in short-lived Gradio request cycles.
248
+ - `src/routing/adaptive_router.py`, `src/synthesis/response.py`, `src/tools/sql_tool.py` — every `ChatOpenAI.invoke(...)` call now passes `config={"callbacks": get_callback_handler(), "run_name": "...", "metadata": {...}}` so token usage + cost get captured automatically.
249
+
250
+ ### Evaluation
251
+
252
+ - `src/eval/golden.jsonl` — **minimal smoke set** (≈5 rows, one per strategy) to avoid burning tokens; extend the file anytime you want stronger coverage.
253
+ - `src/eval/run_routing_eval.py` — router-only accuracy + breakdown; **`--threshold` is opt-in** (default: print report only) so tiny goldens don’t spam failures
254
+ - `src/eval/run_deepeval.py` — runs the full dispatcher on retrieval-bearing examples and scores them with DeepEval's `FaithfulnessMetric`, `AnswerRelevancyMetric`, `ContextualRelevancyMetric`. Emits both a JSON dump and a self-contained HTML report under `src/eval/reports/`.
255
+ - `src/eval/__init__.py` + `src/eval/reports/` (gitignored)
256
+
257
+ ### UI
258
+
259
+ - New tab: **Admin** — Langfuse cost / usage dashboard with selectable window (24h / 7d / 30d), per-model breakdown, per-day breakdown. Friendly empty-state when keys aren't configured.
260
+
261
+ ### Dependencies
262
+
263
+ - `langfuse>=4.0.0`
264
+ - `deepeval>=3.0.0`
265
+
266
+ ### Configuration
267
+
268
+ - `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, `LANGFUSE_HOST` added to `.env`, `.env.example`, and `src/config/settings.py`. `Settings.langfuse_enabled` returns `True` only when both keys are set.
269
+
270
+ **Acceptance:**
271
+
272
+ 1. ✅ Routing eval prints per-strategy accuracy and writes `src/eval/reports/routing.json`. Pass `--threshold 0.85` in CI when you want a hard gate.
273
+ 2. ✅ DeepEval eval emits faithfulness / answer relevancy / contextual relevancy in both JSON and HTML.
274
+ 3. ✅ Every chat turn produces a Langfuse trace with router / retrieval / SQL / synthesis spans (when keys are set; otherwise the app behaves identically and the spans are no-ops).
275
+ 4. ✅ Admin tab renders cost + token totals (and a friendly setup message when Langfuse is disabled).
276
+
277
+ ---
278
+
279
+ ## Phase 7 — Stretch Goals ⏸️
280
+
281
+ Optional, only if time permits.
282
+
283
+ - **C-RAG self-reflection** — grade retrieved context, fall back to web search if low relevance
284
+ - **Multi-hop retrieval** — when `clarify` strategy escalates to step-by-step search
285
+ - **MCP server surface** (`src/mcp_server/server.py`) — expose `search_docs` and `query_sql` tools to Cursor / Claude Desktop
286
+ - **Web search fallback** — Tavily / Exa when context insufficient
287
+ - **Streaming responses** — wire LLM streaming through Gradio
288
+ - **Multi-collection** — split per-domain (policies, finance, technical)
289
+ - **OCR of in-line images** — extract images from Docling output, OCR them, inline into markdown
290
+
291
+ ---
292
+
293
+ ## Currently Working On
294
+
295
+ **Phase 7 — Stretch Goals** ⏸️
296
+
297
+ Phase 6 is complete. Pick whichever stretch goal is most valuable next: streaming responses through Gradio, MCP server surface for Cursor / Claude Desktop, or C-RAG self-reflection with web search fallback.
298
+
299
+ ---
300
+
301
+ ## Quick Status
302
+
303
+
304
+ | Phase | Status | % |
305
+ | ----------------------- | ------ | ---- |
306
+ | 0. Setup | ✅ | 100% |
307
+ | 1. Docling baseline | ✅ | 100% |
308
+ | 2. Parser router + Qwen | ✅ | 100% |
309
+ | 3. Chunking + indexing | ✅ | 100% |
310
+ | 4. Retrieval + chat | ✅ | 100% |
311
+ | 5. Adaptive router | ✅ | 100% |
312
+ | 6. Eval + polish | ✅ | 100% |
313
+ | 7. Stretch | ⏸️ | — |
314
+
315
+
316
+ Last updated: 2026-05-15
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Anthropic, PBC.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.