absencecritic 0.1.0__tar.gz
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.
- absencecritic-0.1.0/.cursor/commands/check-architecture.md +7 -0
- absencecritic-0.1.0/.cursor/commands/new-provider.md +5 -0
- absencecritic-0.1.0/.cursor/commands/new-store-entry.md +5 -0
- absencecritic-0.1.0/.cursor/commands/open-pr.md +5 -0
- absencecritic-0.1.0/.cursor/commands/review-pr.md +5 -0
- absencecritic-0.1.0/.cursor/commands/run-eval.md +5 -0
- absencecritic-0.1.0/.cursor/rules/architecture.mdc +19 -0
- absencecritic-0.1.0/.cursor/rules/docs-origin.mdc +11 -0
- absencecritic-0.1.0/.cursor/rules/git-text.mdc +12 -0
- absencecritic-0.1.0/.cursor/rules/prompts.mdc +13 -0
- absencecritic-0.1.0/.cursor/rules/pull-requests.mdc +15 -0
- absencecritic-0.1.0/.cursor/rules/python.mdc +15 -0
- absencecritic-0.1.0/.cursor/rules/solid.mdc +16 -0
- absencecritic-0.1.0/.cursor/rules/store-data.mdc +15 -0
- absencecritic-0.1.0/.cursor/skills/add-llm-adapter/SKILL.md +14 -0
- absencecritic-0.1.0/.cursor/skills/add-store-entry/SKILL.md +14 -0
- absencecritic-0.1.0/.cursor/skills/architecture-guard/SKILL.md +24 -0
- absencecritic-0.1.0/.cursor/skills/open-pull-request/SKILL.md +29 -0
- absencecritic-0.1.0/.cursor/skills/review-pull-request/SKILL.md +49 -0
- absencecritic-0.1.0/.cursor/skills/run-phase-eval/SKILL.md +23 -0
- absencecritic-0.1.0/.env.example +18 -0
- absencecritic-0.1.0/.github/copilot-instructions.md +6 -0
- absencecritic-0.1.0/.github/pull_request_template.md +13 -0
- absencecritic-0.1.0/.github/workflows/ci.yml +50 -0
- absencecritic-0.1.0/.github/workflows/release.yml +74 -0
- absencecritic-0.1.0/.gitignore +39 -0
- absencecritic-0.1.0/AGENTS.md +104 -0
- absencecritic-0.1.0/CHANGELOG.md +33 -0
- absencecritic-0.1.0/CITATION.cff +25 -0
- absencecritic-0.1.0/CLAUDE.md +19 -0
- absencecritic-0.1.0/CONTRIBUTING.md +43 -0
- absencecritic-0.1.0/LICENSE +202 -0
- absencecritic-0.1.0/NOTICE +14 -0
- absencecritic-0.1.0/PKG-INFO +214 -0
- absencecritic-0.1.0/README.md +184 -0
- absencecritic-0.1.0/data/non_survivors/entries.yaml +218 -0
- absencecritic-0.1.0/docs/00-README.md +35 -0
- absencecritic-0.1.0/docs/01-wald-origin.md +67 -0
- absencecritic-0.1.0/docs/02-missing-planes-in-llms.md +62 -0
- absencecritic-0.1.0/docs/03-bulletproof-shield-design.md +119 -0
- absencecritic-0.1.0/docs/04-implementation-roadmap.md +65 -0
- absencecritic-0.1.0/eval/benchmark/README.md +35 -0
- absencecritic-0.1.0/eval/benchmark/fixtures.yaml +124 -0
- absencecritic-0.1.0/eval/benchmark/items.yaml +271 -0
- absencecritic-0.1.0/eval/benchmark/judge.md +17 -0
- absencecritic-0.1.0/eval/benchmark/judge.py +137 -0
- absencecritic-0.1.0/eval/benchmark/run.py +103 -0
- absencecritic-0.1.0/eval/benchmark/score.py +161 -0
- absencecritic-0.1.0/eval/export_gold.py +227 -0
- absencecritic-0.1.0/eval/export_pairs.py +162 -0
- absencecritic-0.1.0/eval/fixtures/responses.yaml +519 -0
- absencecritic-0.1.0/eval/gold/critiques.jsonl +15 -0
- absencecritic-0.1.0/eval/gold/heldout.jsonl +4 -0
- absencecritic-0.1.0/eval/gold/incoming/README.md +10 -0
- absencecritic-0.1.0/eval/gold/overlay.yaml +67 -0
- absencecritic-0.1.0/eval/gold/splits.yaml +25 -0
- absencecritic-0.1.0/eval/gold/train.jsonl +11 -0
- absencecritic-0.1.0/eval/incoming.py +138 -0
- absencecritic-0.1.0/eval/log_incoming.py +66 -0
- absencecritic-0.1.0/eval/pairs/README.md +10 -0
- absencecritic-0.1.0/eval/queries.yaml +49 -0
- absencecritic-0.1.0/eval/queries_paraphrase.yaml +37 -0
- absencecritic-0.1.0/eval/record_fixtures.py +87 -0
- absencecritic-0.1.0/eval/run_eval.py +219 -0
- absencecritic-0.1.0/plans/README.md +48 -0
- absencecritic-0.1.0/plans/phase-0.md +93 -0
- absencecritic-0.1.0/plans/phase-1.md +165 -0
- absencecritic-0.1.0/plans/phase-2.md +182 -0
- absencecritic-0.1.0/plans/phase-3.md +174 -0
- absencecritic-0.1.0/pyproject.toml +59 -0
- absencecritic-0.1.0/scripts/critic_train.md +47 -0
- absencecritic-0.1.0/scripts/primary_preference.md +39 -0
- absencecritic-0.1.0/scripts/train_critic.py +114 -0
- absencecritic-0.1.0/scripts/train_primary.py +75 -0
- absencecritic-0.1.0/src/absencecritic/__init__.py +10 -0
- absencecritic-0.1.0/src/absencecritic/__main__.py +6 -0
- absencecritic-0.1.0/src/absencecritic/adapters/__init__.py +2 -0
- absencecritic-0.1.0/src/absencecritic/adapters/cli/__init__.py +6 -0
- absencecritic-0.1.0/src/absencecritic/adapters/cli/main.py +213 -0
- absencecritic-0.1.0/src/absencecritic/adapters/llm/__init__.py +8 -0
- absencecritic-0.1.0/src/absencecritic/adapters/llm/fixture.py +62 -0
- absencecritic-0.1.0/src/absencecritic/adapters/llm/local.py +38 -0
- absencecritic-0.1.0/src/absencecritic/adapters/llm/openai_compat.py +197 -0
- absencecritic-0.1.0/src/absencecritic/adapters/store/__init__.py +18 -0
- absencecritic-0.1.0/src/absencecritic/adapters/store/catalog.py +94 -0
- absencecritic-0.1.0/src/absencecritic/adapters/store/feedback.py +94 -0
- absencecritic-0.1.0/src/absencecritic/adapters/store/ingest.py +27 -0
- absencecritic-0.1.0/src/absencecritic/adapters/store/yaml_store.py +309 -0
- absencecritic-0.1.0/src/absencecritic/application/__init__.py +6 -0
- absencecritic-0.1.0/src/absencecritic/application/jsonutil.py +32 -0
- absencecritic-0.1.0/src/absencecritic/application/loop.py +101 -0
- absencecritic-0.1.0/src/absencecritic/application/ports.py +31 -0
- absencecritic-0.1.0/src/absencecritic/application/retrieve.py +40 -0
- absencecritic-0.1.0/src/absencecritic/cli.py +6 -0
- absencecritic-0.1.0/src/absencecritic/domain/__init__.py +22 -0
- absencecritic-0.1.0/src/absencecritic/domain/models.py +89 -0
- absencecritic-0.1.0/src/absencecritic/envfile.py +35 -0
- absencecritic-0.1.0/src/absencecritic/paths.py +34 -0
- absencecritic-0.1.0/src/absencecritic/prompts/__init__.py +25 -0
- absencecritic-0.1.0/src/absencecritic/prompts/critic.md +33 -0
- absencecritic-0.1.0/src/absencecritic/prompts/draft.md +2 -0
- absencecritic-0.1.0/src/absencecritic/prompts/revise.md +10 -0
- absencecritic-0.1.0/tests/fixtures/catalog.yaml +54 -0
- absencecritic-0.1.0/tests/fixtures/incoming_sample.jsonl +1 -0
- absencecritic-0.1.0/tests/test_architecture.py +33 -0
- absencecritic-0.1.0/tests/test_benchmark.py +207 -0
- absencecritic-0.1.0/tests/test_catalog.py +74 -0
- absencecritic-0.1.0/tests/test_cli.py +131 -0
- absencecritic-0.1.0/tests/test_envfile.py +14 -0
- absencecritic-0.1.0/tests/test_eval.py +91 -0
- absencecritic-0.1.0/tests/test_export_pairs.py +117 -0
- absencecritic-0.1.0/tests/test_feedback.py +84 -0
- absencecritic-0.1.0/tests/test_gold.py +163 -0
- absencecritic-0.1.0/tests/test_incoming.py +124 -0
- absencecritic-0.1.0/tests/test_jsonutil.py +20 -0
- absencecritic-0.1.0/tests/test_local_critic.py +84 -0
- absencecritic-0.1.0/tests/test_openai_compat.py +126 -0
- absencecritic-0.1.0/tests/test_org_store.py +66 -0
- absencecritic-0.1.0/tests/test_paths.py +42 -0
- absencecritic-0.1.0/tests/test_pipeline.py +95 -0
- absencecritic-0.1.0/tests/test_prompts.py +25 -0
- absencecritic-0.1.0/tests/test_record_fixtures.py +45 -0
- absencecritic-0.1.0/tests/test_retrieve_k.py +68 -0
- absencecritic-0.1.0/tests/test_schemas.py +103 -0
- absencecritic-0.1.0/tests/test_score.py +54 -0
- absencecritic-0.1.0/tests/test_store.py +245 -0
- absencecritic-0.1.0/tests/test_text_encoding.py +82 -0
- absencecritic-0.1.0/tests/test_train_critic.py +60 -0
- absencecritic-0.1.0/tests/test_train_primary.py +82 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Check the working tree against AbsenceCritic ports-and-adapters rules
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Run the `architecture-guard` skill on the current diff and untracked files.
|
|
6
|
+
|
|
7
|
+
Read AGENTS.md, then list import-direction or Wald-isolation violations. Verdict: pass or fail. Do not commit.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Ports-and-adapters layout and Wald-loop isolation for AbsenceCritic
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture
|
|
7
|
+
|
|
8
|
+
Linear Wald loop: generate -> retrieve (critic only) -> critique JSON -> revise. No LangGraph/LangChain/DSPy.
|
|
9
|
+
|
|
10
|
+
- `domain/` - models only; no I/O
|
|
11
|
+
- `application/` - `WaldLoop`; ports only, no HTTP/YAML
|
|
12
|
+
- `adapters/` - LLM, store, CLI
|
|
13
|
+
- `prompts/` - prompt text only
|
|
14
|
+
|
|
15
|
+
The generator must never receive Non-Survivor Store hits. Critic output is validated `Critique` JSON. New features land in the matching layer or they do not land.
|
|
16
|
+
|
|
17
|
+
Do not put business logic in the CLI. Do not collapse draft+critic into one prompt. Same HTTP class may implement both LLM ports; calls stay separate (`generate` / `critique` / `revise`).
|
|
18
|
+
|
|
19
|
+
Policy source of truth is AGENTS.md, not this file. Do not maintain a Claude-only or Copilot-only copy of these rules.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Origin design documents are frozen unless the user asks to edit them
|
|
3
|
+
globs: docs/**
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Origin docs
|
|
8
|
+
|
|
9
|
+
`docs/` is the conceptual origin package (`00` through `04`). Do not rewrite, shorten, or "improve" it during refactors. Edit only when the user explicitly asks. Keep SPDX headers if you do edit.
|
|
10
|
+
|
|
11
|
+
Working plans live in `plans/` and are not origin. Do not copy them into `docs/` unless the user asked.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Clean UTF-8 for git commits and GitHub PR summaries
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git text
|
|
7
|
+
|
|
8
|
+
Commit titles and PR summaries are UTF-8. Use plain punctuation or emoji. Do not use curly quotes, ellipsis characters, or em dashes.
|
|
9
|
+
|
|
10
|
+
Write PR bodies with Python Path.write_text and `gh pr create --body-file`. Never put markdown backticks in a PowerShell string: backtick+a is BEL and GitHub shows a replacement character.
|
|
11
|
+
|
|
12
|
+
`tests/test_text_encoding.py` fails CI on U+FFFD, BEL, C0/C1 controls, UTF-8 BOM, and classic mojibake. Origin `docs/` may keep historical punctuation; they must still be valid UTF-8.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Wald prompt assets stay separate from pipeline and store I/O
|
|
3
|
+
globs: src/absencecritic/prompts/**
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Prompts
|
|
8
|
+
|
|
9
|
+
Edit wording here, not inside `WaldLoop` or adapters beyond loading these files.
|
|
10
|
+
|
|
11
|
+
- Draft/generate: no store, no survivorship lecture unless the user asked
|
|
12
|
+
- Critic: Wald checklist; JSON only; use provided store hits; mark unknown lethality; do not invent lost cases
|
|
13
|
+
- Revise: apply `confidence_adjustment`; do not add anecdotes absent from the critique
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Pull-request workflow; do not land work on main
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pull requests
|
|
7
|
+
|
|
8
|
+
Policy lives in AGENTS.md. Skills: `.cursor/skills/open-pull-request/` and `review-pull-request/`.
|
|
9
|
+
|
|
10
|
+
- Feature work goes on a branch and a GitHub PR against `main`. Do not push features to `main`.
|
|
11
|
+
- One concern per PR. Do not commit `.env` or keys.
|
|
12
|
+
- Before opening: architecture-guard, pytest, fixture eval.
|
|
13
|
+
- Reviews: architecture and SOLID first, then tests, then nits. Block Wald-invariant breaks.
|
|
14
|
+
- Do not merge, force-push `main`, or skip hooks unless the user asked.
|
|
15
|
+
- Origin `docs/` stay frozen unless the PR is explicitly about them.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Python conventions for AbsenceCritic library and tests
|
|
3
|
+
globs: src/**/*.py,tests/**/*.py
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Python
|
|
8
|
+
|
|
9
|
+
- SPDX header: `Copyright 2026 Guzino (https://github.com/guzino)` and `SPDX-License-Identifier: Apache-2.0`
|
|
10
|
+
- Python 3.10+; pydantic v2 for domain models
|
|
11
|
+
- Domain must not import `adapters` or `application`
|
|
12
|
+
- Application must not import `adapters`
|
|
13
|
+
- Prefer ports over passing a raw `stage=` string through the loop
|
|
14
|
+
- No secrets in source; live keys via env only
|
|
15
|
+
- Tests use the fixture LLM unless the user asked for a live provider
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: SOLID mapped to AbsenceCritic layers and ports
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SOLID
|
|
7
|
+
|
|
8
|
+
Canonical mapping is in AGENTS.md. Do not invent a second object model.
|
|
9
|
+
|
|
10
|
+
- **S** - One layer, one Wald stage. CLI is not the loop. Prompts are not orchestration.
|
|
11
|
+
- **O** - New provider or store = new adapter. Do not edit `WaldLoop` unless the port changes.
|
|
12
|
+
- **L** - Fixture and live adapters substitute. Critique is still `Critique` JSON; generate still has no store.
|
|
13
|
+
- **I** - `GeneratorPort`, `CriticPort`, `StorePort` stay separate. No mega-port.
|
|
14
|
+
- **D** - Application depends on ports; adapters depend inward.
|
|
15
|
+
|
|
16
|
+
A collapsed draft+critic prompt or HTTP inside `domain/` fails SOLID and architecture together.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Non-Survivor Store entry requirements
|
|
3
|
+
globs: data/non_survivors/**
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Store data
|
|
8
|
+
|
|
9
|
+
Every entry needs `id`, `domain`, `selection_process`, `survivor_pattern`, `non_survivor_evidence`, `confidence` (0-1), and `provenance`. Optional: `collection` (seed|catalog|feedback, default seed), `source_url`, `ingested_at`.
|
|
10
|
+
|
|
11
|
+
- `provenance` is a real citation or the exact phrase `author prior, low confidence`
|
|
12
|
+
- Provenance starting with "author prior" sets `evidence: author_prior`; confidence must be <= 0.5 (ingest rejects higher)
|
|
13
|
+
- Quote YAML scalars that contain `:` or inner quotes
|
|
14
|
+
- Do not invent specific unpublished events as fact
|
|
15
|
+
- After adding an entry, smoke retrieval on a related query
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-llm-adapter
|
|
3
|
+
description: Scaffold an LLM adapter that implements GeneratorPort and CriticPort without editing WaldLoop. Use when adding a provider, OpenAI-compatible backend, local model, or fixture LLM.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add LLM adapter
|
|
7
|
+
|
|
8
|
+
1. Implement both ports in `src/absencecritic/adapters/llm/` with **separate** methods: `generate`, `critique`, `revise`.
|
|
9
|
+
2. Load prompt text from `src/absencecritic/prompts/`. Do not inline a mega-prompt.
|
|
10
|
+
3. `generate` / `revise` must not take store hits. `critique` receives formatted store hits only.
|
|
11
|
+
4. Wire the name in `src/absencecritic/adapters/cli/main.py` (`--provider`) if it should be user-selectable.
|
|
12
|
+
5. Do not edit `application/loop.py` unless a port signature must change.
|
|
13
|
+
6. Tests: fixture-first. Live HTTP only when the user asked.
|
|
14
|
+
7. SPDX header. No LangChain/LangGraph/DSPy.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-store-entry
|
|
3
|
+
description: Add a Non-Survivor Store YAML entry with required provenance and a retrieval smoke check. Use when adding store notes, failure memory, post-mortems, or data/non_survivors entries.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add store entry
|
|
7
|
+
|
|
8
|
+
1. Prefer `absencecritic ingest path/to/entries.yaml` or `absencecritic ingest --catalog path.yaml` (writes `ingested.yaml`). Or append by hand to [data/non_survivors/entries.yaml](../../../data/non_survivors/entries.yaml).
|
|
9
|
+
2. Required fields: `id`, `domain`, `selection_process`, `survivor_pattern`, `non_survivor_evidence`, `confidence`, `provenance`. Optional: `collection` (seed|catalog|feedback), `source_url`, `ingested_at`.
|
|
10
|
+
3. `provenance` is a real citation or `author prior, low confidence`. An author prior is tagged `evidence: author_prior`, shown to the critic as such, and capped at confidence 0.5. Prefer finding a citation over adding a prior.
|
|
11
|
+
4. Quote scalars that contain `:` or inner `"`.
|
|
12
|
+
5. Do not invent a specific unpublished event as fact.
|
|
13
|
+
6. Smoke: load `YamlStore` and `retrieve` a query that should rank this `id` in the top hits.
|
|
14
|
+
7. SPDX on new files. Do not change `WaldLoop` for a data add.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-guard
|
|
3
|
+
description: Check AbsenceCritic diffs for ports-and-adapters import direction and Wald stage isolation. Use when adding files, moving modules, reviewing PRs, refactoring, or when the user asks to check architecture.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture guard
|
|
7
|
+
|
|
8
|
+
Read [AGENTS.md](../../../AGENTS.md) (canonical for every tool). Then inspect the diff (or named files).
|
|
9
|
+
|
|
10
|
+
## Checks
|
|
11
|
+
|
|
12
|
+
1. `domain/` imports only stdlib/pydantic - never `application` or `adapters`.
|
|
13
|
+
2. `application/` never imports `adapters`.
|
|
14
|
+
3. `WaldLoop` does not pass store hits into `generate`.
|
|
15
|
+
4. Critic path parses/validates `Critique`; generator path does not load the store.
|
|
16
|
+
5. No new LangChain/LangGraph/DSPy dependency.
|
|
17
|
+
6. New code sits in the matching layer (see AGENTS.md table).
|
|
18
|
+
7. SPDX header present on new source files.
|
|
19
|
+
8. SOLID mapping in AGENTS.md: no collapsed stages, no loop edit for a new vendor, ports stay segregated.
|
|
20
|
+
9. Tracked text is UTF-8 with no U+FFFD, BEL, C0/C1 controls, or UTF-8 BOM (`tests/test_text_encoding.py`).
|
|
21
|
+
|
|
22
|
+
## Report
|
|
23
|
+
|
|
24
|
+
List violations first, then a one-line verdict: pass or fail. If fail, say the exact file and the rule broken. Do not "fix" origin `docs/` while repairing architecture.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: open-pull-request
|
|
3
|
+
description: Open a GitHub pull request for AbsenceCritic against main. Use when the user asks to open, create, or file a PR, pull request, or to land work off main.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Open a pull request
|
|
7
|
+
|
|
8
|
+
Read [AGENTS.md](../../../AGENTS.md) (SOLID + PR sections). Policy is there; this file is the procedure.
|
|
9
|
+
|
|
10
|
+
## Do not
|
|
11
|
+
|
|
12
|
+
- Push feature commits to `main`.
|
|
13
|
+
- Commit `.env`, keys, or secret-bearing logs.
|
|
14
|
+
- Skip pytest / fixture eval.
|
|
15
|
+
- Rewrite origin `docs/` unless the user asked.
|
|
16
|
+
- Open a PR that mixes unrelated layers (split instead).
|
|
17
|
+
|
|
18
|
+
## Steps
|
|
19
|
+
|
|
20
|
+
1. `git status`, `git diff`, `git log` and `git diff main...HEAD` (or the default branch). Confirm `.env` is untracked.
|
|
21
|
+
2. Run the architecture-guard skill on the branch diff.
|
|
22
|
+
3. Run `python -m pytest` and `python eval/run_eval.py --provider fixture`. Live eval only if the user asked.
|
|
23
|
+
4. Check SOLID: new backends are adapters; loop/ports unchanged unless the contract changed; generate still has no store hits.
|
|
24
|
+
5. Create/switch a branch if still on `main` (`feat/...`, `fix/...`, `docs/...`).
|
|
25
|
+
6. Commit only if the user asked. Push with `git push -u origin HEAD`.
|
|
26
|
+
7. Write the PR body to a UTF-8 file (Python Path.write_text, not a PowerShell here-string). Then `gh pr create --body-file that-file`. Title and summary state why the change exists and what to try. Do not list files, pointer docs, or invariants this diff did not change. Emoji is welcome. Do not put markdown code spans inside PowerShell-quoted strings (PowerShell treats backtick+letter as an escape; backtick+a is BEL and GitHub shows a replacement character).
|
|
27
|
+
8. Return the PR URL. Do not merge unless the user asked.
|
|
28
|
+
|
|
29
|
+
Windows: use `gh`; do not invent a GitHub API client. Commit and PR text is UTF-8: ASCII punctuation or emoji, not smart quotes.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pull-request
|
|
3
|
+
description: Review an AbsenceCritic GitHub pull request for Wald isolation, SOLID, and fixture tests. Use when reviewing a PR, pull request, code review, or reviewing branch changes before merge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review a pull request
|
|
7
|
+
|
|
8
|
+
Read [AGENTS.md](../../../AGENTS.md). Then inspect the PR diff, not only the latest commit.
|
|
9
|
+
|
|
10
|
+
## Gather
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
gh pr view <n> --json title,body,author,baseRefName,headRefName,files,commits
|
|
14
|
+
gh pr diff <n>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If reviewing local uncommitted work, use `git diff` / `git diff main...HEAD` instead.
|
|
18
|
+
|
|
19
|
+
## Block (must fix)
|
|
20
|
+
|
|
21
|
+
1. Generator receives store hits, or draft+critic collapsed into one prompt.
|
|
22
|
+
2. Import direction: `domain/` -> application/adapters; `application/` -> adapters.
|
|
23
|
+
3. SOLID: loop edited for a new vendor; mega-port; CLI owning loop policy; HTTP in domain.
|
|
24
|
+
4. LangChain / LangGraph / DSPy (Phase 0-1).
|
|
25
|
+
5. Store entry without `provenance`; invented failure anecdotes.
|
|
26
|
+
6. Secrets, `.env`, or SPDX missing on new source files.
|
|
27
|
+
7. Origin `docs/` rewritten without an explicit ask.
|
|
28
|
+
8. Tests/eval not run or CI fixture job skipped in spirit (no live keys in CI).
|
|
29
|
+
|
|
30
|
+
## Check but do not block on taste
|
|
31
|
+
|
|
32
|
+
Prompt wording, comment style, extra fixtures that still pass architecture.
|
|
33
|
+
|
|
34
|
+
## Report
|
|
35
|
+
|
|
36
|
+
Use this shape:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Verdict: approve | request changes
|
|
40
|
+
Blockers: ...
|
|
41
|
+
SOLID: pass | fail (principle + file)
|
|
42
|
+
Wald invariant: pass | fail
|
|
43
|
+
Tests: pytest / fixture eval (ran or inferred from CI)
|
|
44
|
+
Nits: ...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Post GitHub review comments only if the user asked to submit the review (`gh pr review`). Otherwise print the report in chat.
|
|
48
|
+
|
|
49
|
+
Do not merge, do not push to `main`, do not "fix" origin docs while repairing the PR unless that was the task.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: run-phase-eval
|
|
3
|
+
description: Run AbsenceCritic Phase 0 pytest and fixture eval. Use when verifying the Wald loop, after pipeline or fixture changes, or when the user asks to run eval.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run phase eval
|
|
7
|
+
|
|
8
|
+
Default is fixtures (no API key).
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python -m pytest
|
|
12
|
+
python eval/run_eval.py --provider fixture
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Live provider only if the user asked:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python eval/run_eval.py --provider openai
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Report pytest counts and eval `passed/total`. If a biased case fails missing-data language, fix the **fixture revision** or scorer - do not weaken domain invariants. If a control abstains, that is a fail.
|
|
22
|
+
|
|
23
|
+
GitHub Actions (`.github/workflows/ci.yml`) runs the fixture pair only. Do not add `OPENAI_API_KEY` to CI.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright 2026 Guzino (https://github.com/guzino)
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Optional live provider. Tests and CI default to fixtures.
|
|
5
|
+
# Copy to .env (gitignored) and set the key.
|
|
6
|
+
|
|
7
|
+
# OPENAI_API_KEY=
|
|
8
|
+
# OPENAI_BASE_URL=https://api.openai.com/v1
|
|
9
|
+
# OpenRouter: OPENAI_BASE_URL=https://openrouter.ai/api/v1
|
|
10
|
+
# Local generate/revise server: OPENAI_BASE_URL=http://127.0.0.1:8080/v1
|
|
11
|
+
# ABSENCECRITIC_MODEL=gpt-4o-mini
|
|
12
|
+
# ABSENCECRITIC_HTTP_TIMEOUT=120
|
|
13
|
+
# ABSENCECRITIC_HTTP_RETRIES=3
|
|
14
|
+
# ABSENCECRITIC_LOCAL_BASE_URL=http://127.0.0.1:8080/v1
|
|
15
|
+
# ABSENCECRITIC_LOCAL_CRITIC_MODEL=absencecritic-critic
|
|
16
|
+
# ABSENCECRITIC_LOCAL_API_KEY=local
|
|
17
|
+
# ABSENCECRITIC_STORE=
|
|
18
|
+
# ABSENCECRITIC_FIXTURES=
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2026 Guzino (https://github.com/guzino)
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
Follow AGENTS.md in the repository root. Ports-and-adapters, linear Wald loop, generator never sees the Non-Survivor Store. SOLID is mapped to those layers in AGENTS.md. Land work via pull requests, not `main`. Shared workflows are in `.cursor/skills/*/SKILL.md` (generic content; path is the Cursor auto-load location).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2026 Guzino (https://github.com/guzino)
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
## Summary
|
|
7
|
+
|
|
8
|
+
<!-- Why this change exists and what to try. Not a file list. Do not recite invariants or layers that this diff does not change. -->
|
|
9
|
+
|
|
10
|
+
## Test plan
|
|
11
|
+
|
|
12
|
+
- [ ] `python -m pytest`
|
|
13
|
+
- [ ] `python eval/run_eval.py --provider fixture` (if loop, store, prompts, or eval changed)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Copyright 2026 Guzino (https://github.com/guzino)
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
python-version: ["3.10", "3.12"]
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
- name: Install
|
|
27
|
+
run: python -m pip install -e ".[dev]"
|
|
28
|
+
- name: Pytest
|
|
29
|
+
run: python -m pytest
|
|
30
|
+
- name: Fixture eval
|
|
31
|
+
run: python eval/run_eval.py --provider fixture
|
|
32
|
+
|
|
33
|
+
package:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
- name: Build sdist and wheel
|
|
41
|
+
run: |
|
|
42
|
+
python -m pip install build
|
|
43
|
+
python -m build
|
|
44
|
+
- name: Install wheel in a clean venv and run outside the checkout
|
|
45
|
+
run: |
|
|
46
|
+
python -m venv /tmp/ac
|
|
47
|
+
/tmp/ac/bin/pip install dist/*.whl
|
|
48
|
+
cd /tmp
|
|
49
|
+
/tmp/ac/bin/absencecritic --provider fixture "What works for launching a startup?"
|
|
50
|
+
/tmp/ac/bin/absencecritic --provider fixture --json "What is 2+2?" | /tmp/ac/bin/python -c "import json,sys; d=json.load(sys.stdin); assert d['final'], d"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright 2026 Guzino (https://github.com/guzino)
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Publishing a GitHub Release (tag vX.Y.Z) builds, checks, and uploads to PyPI
|
|
5
|
+
# via Trusted Publishing. No API token is stored in the repo.
|
|
6
|
+
|
|
7
|
+
name: Release
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [published]
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
- name: Tag must match the package version
|
|
25
|
+
run: |
|
|
26
|
+
version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
27
|
+
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
|
|
28
|
+
echo "tag ${GITHUB_REF_NAME} does not match pyproject version ${version}"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
- name: Test
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install -e ".[dev]"
|
|
34
|
+
python -m pytest
|
|
35
|
+
python eval/run_eval.py --provider fixture
|
|
36
|
+
- name: Build and check
|
|
37
|
+
run: |
|
|
38
|
+
python -m pip install build twine
|
|
39
|
+
python -m build
|
|
40
|
+
python -m twine check dist/*
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
|
|
46
|
+
publish-pypi:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
environment:
|
|
50
|
+
name: pypi
|
|
51
|
+
url: https://pypi.org/p/absencecritic
|
|
52
|
+
permissions:
|
|
53
|
+
id-token: write
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/download-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: dist
|
|
58
|
+
path: dist/
|
|
59
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
60
|
+
|
|
61
|
+
attach-to-release:
|
|
62
|
+
needs: publish-pypi
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
permissions:
|
|
65
|
+
contents: write
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: dist
|
|
70
|
+
path: dist/
|
|
71
|
+
- name: Upload sdist and wheel to the GitHub Release
|
|
72
|
+
env:
|
|
73
|
+
GH_TOKEN: ${{ github.token }}
|
|
74
|
+
run: gh release upload "${GITHUB_REF_NAME}" dist/* --repo "${GITHUB_REPOSITORY}"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Secrets and local env
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
!.env.example
|
|
5
|
+
|
|
6
|
+
# Local / org Non-Survivor Store (never commit)
|
|
7
|
+
data/non_survivors/private/
|
|
8
|
+
data/non_survivors/feedback/
|
|
9
|
+
|
|
10
|
+
# Live critic quarantine (promote with a human PR, never by script)
|
|
11
|
+
eval/gold/incoming/*.jsonl
|
|
12
|
+
|
|
13
|
+
# OS / editor
|
|
14
|
+
.DS_Store
|
|
15
|
+
Thumbs.db
|
|
16
|
+
*.swp
|
|
17
|
+
.idea/
|
|
18
|
+
.vscode/
|
|
19
|
+
|
|
20
|
+
# Python / tooling (for later implementation)
|
|
21
|
+
__pycache__/
|
|
22
|
+
*.py[cod]
|
|
23
|
+
.venv/
|
|
24
|
+
venv/
|
|
25
|
+
dist/
|
|
26
|
+
build/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.pytest_cache/
|
|
29
|
+
.mypy_cache/
|
|
30
|
+
.ruff_cache/
|
|
31
|
+
|
|
32
|
+
# Local critic train exports (not gold)
|
|
33
|
+
scripts/out/
|
|
34
|
+
|
|
35
|
+
# Preference-pair dumps (may include live model text)
|
|
36
|
+
eval/pairs/*.jsonl
|
|
37
|
+
|
|
38
|
+
# Benchmark answer dumps
|
|
39
|
+
eval/benchmark/*.jsonl
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2026 Guzino (https://github.com/guzino)
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# AbsenceCritic agent guide
|
|
7
|
+
|
|
8
|
+
Tool-agnostic rules for humans and coding agents (Claude Code, Cursor, Copilot, or anything else). Policy lives here. Editor-specific loaders are thin pointers; do not fork these rules per tool.
|
|
9
|
+
|
|
10
|
+
Ports-and-adapters around a linear Wald loop. Not LangGraph. Not a single mega-prompt.
|
|
11
|
+
|
|
12
|
+
**Invariant:** the generator never reads the Non-Survivor Store. Only the critic does.
|
|
13
|
+
|
|
14
|
+
## Layers
|
|
15
|
+
|
|
16
|
+
| Layer | Path | May import | Must not |
|
|
17
|
+
|-------|------|------------|----------|
|
|
18
|
+
| Domain | `src/absencecritic/domain/` | stdlib, pydantic | I/O, prompts, HTTP, adapters, application |
|
|
19
|
+
| Application | `src/absencecritic/application/` | domain, ports, stdlib | adapters, HTTP, YAML files |
|
|
20
|
+
| Prompts | `src/absencecritic/prompts/` | stdlib | pipeline logic, store I/O |
|
|
21
|
+
| Adapters | `src/absencecritic/adapters/` | domain, application.ports, prompts, I/O | other adapters' internals, collapsing stages |
|
|
22
|
+
| Eval | `eval/` | public facade / adapters | rewriting domain models |
|
|
23
|
+
| Origin docs | `docs/` | - | edits unless the user asked |
|
|
24
|
+
| Working plans | `plans/` | - | do not copy into origin `docs/` |
|
|
25
|
+
|
|
26
|
+
Public API: `from absencecritic import run, score, Critique, StoreEntry, PipelineResult`.
|
|
27
|
+
|
|
28
|
+
## Where a change goes
|
|
29
|
+
|
|
30
|
+
- New field on a critique or store entry -> `domain/`
|
|
31
|
+
- Loop steps (draft -> retrieve -> critique -> revise) -> `application/`
|
|
32
|
+
- Prompt wording -> `src/absencecritic/prompts/`
|
|
33
|
+
- HTTP, fixtures, YAML store, CLI -> `adapters/`
|
|
34
|
+
- New LLM backend -> `adapters/llm/` implementing `GeneratorPort` and `CriticPort`; do not edit `WaldLoop` unless the port itself changes
|
|
35
|
+
- New store backend -> `adapters/store/` implementing `StorePort`
|
|
36
|
+
- Eval queries/fixtures -> `eval/`
|
|
37
|
+
- Phase working plans (not origin) -> `plans/`
|
|
38
|
+
|
|
39
|
+
## Forbidden
|
|
40
|
+
|
|
41
|
+
- LangChain, LangGraph, DSPy in Phase 0-1
|
|
42
|
+
- Passing store hits into `generate`
|
|
43
|
+
- Inventing failure anecdotes not in the store or critique
|
|
44
|
+
- Store entries without `provenance`
|
|
45
|
+
- Business logic in the CLI
|
|
46
|
+
- Rewriting `docs/` origin documents unless asked
|
|
47
|
+
- Pushing feature work straight to `main` (use a pull request)
|
|
48
|
+
|
|
49
|
+
## SOLID (mapped to this repo)
|
|
50
|
+
|
|
51
|
+
Apply these on every change and every PR review. They are the same hexagonal rules as the layer table, not a second architecture.
|
|
52
|
+
|
|
53
|
+
| Principle | Here |
|
|
54
|
+
|-----------|------|
|
|
55
|
+
| **S**ingle responsibility | One layer, one Wald stage. Draft does not retrieve. CLI does not own loop policy. Prompts are text, not orchestration. |
|
|
56
|
+
| **O**pen/closed | New LLM or store = new adapter implementing a port. Do not edit `WaldLoop` unless the port contract itself changes. |
|
|
57
|
+
| **L**iskov | `FixtureLLM` and live adapters are substitutes on `GeneratorPort` / `CriticPort`. Critique still validates as `Critique` JSON. Generate still takes no store hits. |
|
|
58
|
+
| **I**nterface segregation | Keep `GeneratorPort`, `CriticPort`, and `StorePort` separate. Do not add store parameters to `generate` to "simplify". |
|
|
59
|
+
| **D**ependency inversion | Application depends on ports. Adapters depend inward. Domain never imports adapters. |
|
|
60
|
+
|
|
61
|
+
A PR that collapses draft+critic into one prompt, or that teaches `domain/` about HTTP, fails SOLID and architecture together.
|
|
62
|
+
|
|
63
|
+
## Pull requests
|
|
64
|
+
|
|
65
|
+
`main` is integration-only. Agents and humans land work through GitHub pull requests.
|
|
66
|
+
|
|
67
|
+
1. Branch from up-to-date `main` (`feat/...`, `fix/...`, `docs/...`). One concern per PR; split mixed layer dumps.
|
|
68
|
+
2. Do not commit `.env`, keys, or live eval transcripts that contain secrets.
|
|
69
|
+
3. Before opening: architecture-guard on the diff, `python -m pytest`, `python eval/run_eval.py --provider fixture`. Live eval only if the user asked.
|
|
70
|
+
4. PR body: why it exists and how to verify. Use `.github/pull_request_template.md`. Do not list files, "pointers," or invariants this diff did not touch. Write the body as a UTF-8 file and pass `--body-file`. Never embed markdown backticks in a PowerShell string: backtick+a is BEL and shows up as a replacement character in GitHub summaries. Plain text and emoji are fine; no curly quotes, ellipsis characters, or em dashes in commit/PR titles.
|
|
71
|
+
5. Reviewers (including agents): architecture and SOLID first, then tests, then nits. Block on invariant breaks. Do not rewrite origin `docs/` in a drive-by review.
|
|
72
|
+
6. Do not merge, force-push `main`, or skip hooks unless the user explicitly asked.
|
|
73
|
+
7. Address review comments with a new commit on the branch (or an explicit amend the user requested). Do not start a parallel rewrite on `main`.
|
|
74
|
+
|
|
75
|
+
Open-PR and review workflows: `.cursor/skills/open-pull-request/SKILL.md` and `.cursor/skills/review-pull-request/SKILL.md`.
|
|
76
|
+
|
|
77
|
+
## Workflows
|
|
78
|
+
|
|
79
|
+
Shared skill files (Agent Skills format; content is generic):
|
|
80
|
+
|
|
81
|
+
| Workflow | File |
|
|
82
|
+
|----------|------|
|
|
83
|
+
| Check layer imports and stage isolation | `.cursor/skills/architecture-guard/SKILL.md` |
|
|
84
|
+
| Add a Non-Survivor Store entry | `.cursor/skills/add-store-entry/SKILL.md` |
|
|
85
|
+
| Add an LLM adapter | `.cursor/skills/add-llm-adapter/SKILL.md` |
|
|
86
|
+
| Run pytest and fixture eval | `.cursor/skills/run-phase-eval/SKILL.md` |
|
|
87
|
+
| Open a GitHub pull request | `.cursor/skills/open-pull-request/SKILL.md` |
|
|
88
|
+
| Review a pull request | `.cursor/skills/review-pull-request/SKILL.md` |
|
|
89
|
+
|
|
90
|
+
The `.cursor/skills/` path is where Cursor auto-loads skills. Claude Code should follow the same files via `CLAUDE.md`. Do not copy the bodies into a second tree.
|
|
91
|
+
|
|
92
|
+
## Tool adapters (pointers only)
|
|
93
|
+
|
|
94
|
+
- Claude Code: [`CLAUDE.md`](CLAUDE.md)
|
|
95
|
+
- GitHub Copilot: [`.github/copilot-instructions.md`](.github/copilot-instructions.md)
|
|
96
|
+
- Cursor: `.cursor/rules/`, `.cursor/skills/`, `.cursor/commands/`
|
|
97
|
+
- Humans: [`CONTRIBUTING.md`](CONTRIBUTING.md)
|
|
98
|
+
|
|
99
|
+
SPDX on every new source file:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Copyright 2026 Guzino (https://github.com/guzino)
|
|
103
|
+
SPDX-License-Identifier: Apache-2.0
|
|
104
|
+
```
|