Skip to main content

Clarent

ci PyPI license: Apache-2.0 python: >=3.11

Classic decision, optimization and engineering methods — as tools that compute, not prompts that sound smart.

Military doctrine, Toyota's shop floor, Soviet inventors' algorithms, NASA safety engineering: decades of method for finding root causes, attacking plans and estimating honestly. Clarent turns them into small, auditable tools for developers and their coding agents: Claude Code skills, a CLI, and (soon) hooks, MCP tools and GitHub Actions.

Status: pre-release (v0.1). Three methods are implemented end-to-end (ach, 24 tests; redteam, 82; triz-matrix, 38). Eight more are specified in research/product-spec.md; the rest of the plan is in research/roadmap.md. Nothing here claims to make your agent fix more bugs — see What we do not claim.

Install

pip install clarent-methods                                        # the `clarent` CLI; Python >= 3.11, no dependencies
# or the development version:  pip install git+https://github.com/Joaquincuevas/clarent
/plugin marketplace add Joaquincuevas/clarent                      # in Claude Code: add the marketplace...
/plugin install clarent-methods@clarent                            # ...and install the skills

Why another methods repo?

Collections of "thinking frameworks as prompts" already exist (the biggest we found has ~1.7k stars; see research/novelty.md). They give an agent a checklist. Clarent's rule is stricter: every method must have a deterministic core — something the code computes or rejects with no LLM involved — plus evidence discipline:

  • the agent proposes, the engine scores, validates and can say no;
  • every observed fact needs a ref (the command, file:line or log that produced it);
  • reports say what they are: an ACH score is a ranking of inconsistencies, never a probability.

Demo

Everything below is the real output of the command shown, on the synthetic examples shipped in methods/. The files in docs/demo/ hold the complete outputs and are regenerated by python tools/gen_demo.py (CI fails if they drift).

ach — debugging with competing hypotheses

A test, test_checkout_total, fails about 1 run in 8 on CI. Five rival causes and a catch-all, five pieces of evidence, each rated against every hypothesis:

$ clarent ach score methods/ach/examples/flaky-test.json

Excerpt (the full report also has the evidence matrix, diagnosticity, sensitivity and warnings — docs/demo/ach-score.md):

## Conclusion

- Tie: several hypotheses share the lowest inconsistency score.
- Leader(s): H1, H5 (margin over the next: 21)
- This is a ranking of inconsistencies, **not a probability**.

## Hypothesis ranking (lower inconsistency = better)

| # | Hypothesis | Inconsistency | State | Contradicted by |
|---|-----------|---------------:|--------|-----------------|
| 1 | **H1** Race condition between xdist workers on a session-scoped fixture | 0 | alive | — |
| 1 | **H5** Leftover DB state from another test that ran earlier on the same worker | 0 | alive | — |
| 1 | **H6** Something else I am not considering | 0 | catch-all | — |
| 2 | **H2** Clock/timezone dependence (datetime.now near a day boundary) | 21 | refuted | E2, E1 |
| 3 | **H3** Real, unmocked network call that sometimes answers slowly or errors | 27 | refuted | E4, E1 |
| 4 | **H4** Non-deterministic set/dict ordering (PYTHONHASHSEED) changes a float sum | 33 | refuted | E3, E1, E5 |

Clock, network and hash-seed causes are refuted by cited evidence; two causes tie. Which single experiment separates them?

$ clarent ach next methods/ach/examples/flaky-test.json
T1  priority=36.0  for=H5  against=H1
    Reproducing serially with the same random order as the failure (pytest-randomly --randomly-seed=<seed of run #8812>) also fails
T2  priority=9.0  for=H1  against=-
    Changing the fixture from scope=session to scope=function removes the failures in 200 runs with '-n 4'

redteam — attack a design or a PR; the engine refuses what it cannot anchor

A synthetic design doc moves notifications from a cron job to a stream consumer (design.md). A model proposes assumptions and attacks as JSON, each quoting the passage it rests on; the engine checks them against the text:

$ clarent redteam check methods/redteam/examples/design-doc/findings.json

Excerpt (the full report also has the assumption matrix, what to verify next, class coverage and warnings — docs/demo/redteam-check.md):

## Top 3 attacks by impact

| # | Attack | Class | Assumption | Risk | Where | How to check |
|--:|---|---|---|---|---|---|
| 1 | **X3** After the rollout there is no way back: the flag cannot bring back the cron job or the sent_at column, so a bad release can only be fixed by shipping another one while notifications are being lost. | Reversibility | A5 (contradicted) | 25 (S1) | `design.md:26` | Apply the migration in staging, then try to revert to the previous release and send a notification. |
| 2 | **X1** If Redis is down when the API publishes, the row stays in the table but nothing reads it once the cron job is gone: those notifications are never sent and nobody is told. | Failure modes | A1 (contradicted) | 20 (S1) | `design.md:19` | Stop Redis in staging, create 20 notifications, restart Redis and count how many are sent. |
| 3 | **X2** A consumer that crashes after the read and before the provider answers loses the notification: acknowledging on read gives at-most-once delivery, and the row stays pending for ever. | Failure modes | A6 (unverified) | 16 (S2) | `design.md:14` | In staging, kill -9 a consumer between the read and the provider call; count the rows still pending after 10 minutes. |

Where is the line of the design the attack quotes; contradicted means the assumption was checked and the evidence says it is false (here, design.md:15 deletes the only reader of the table), which raises the plausibility of every attack that depends on it. X2 rests on an unverified assumption, so the report lists it first under "Verify next".

The same design with findings the engine must refuse (an invented quote, "verified" with no evidence, a ref to a line that does not exist, a duplicate, an attack with no way to check it) exits 1 and says why:

$ clarent redteam check methods/redteam/examples/design-doc/findings.rejected.json
## Rejected findings

| Kind | ID | Reason |
|---|---|---|
| assumption | A3 | the quote does not appear in the target (compared literally, ignoring only whitespace) |
| assumption | A4 | status 'verified' needs at least one evidence item with a ref and an observation |
| assumption | A5 | evidence ref 'design.md:99' is not valid: line out of range (the file has 27 lines) |
| attack | X3 | its assumption A3 was rejected |
| attack | X4 | the quote has 5 characters; at least 12 are required to anchor a finding |
| attack | X5 | duplicate of X2 (same class and assumption, near-identical text) |
| attack | X6 | no 'check': say how to verify this attack (a command or a concrete question) |
| attack | X7 | its assumption A4 was rejected |
| attack | X8 | its assumption A5 was rejected |

The engine proves a finding is anchored and backed, not that it is right. It also works on PRs (description plus gh pr diff): docs/demo/redteam-pr.md.

triz-matrix — a design trade-off, resolved against the 1973 table

"Make /search faster without making the system harder to run":

$ clarent triz-matrix lookup latency "Device complexity"
# TRIZ contradiction: improve «Speed» without worsening «Device complexity»

- **Improving:** 9. Speed — _software reading: latency, response time or throughput of an operation_
- **Worsening:** 36. Device complexity — _software reading: system complexity: number of components, dependencies, code paths_
- «latency» was interpreted as parameter 9 (Speed) by software-reading match

> Cell verified: the consensus of 4 independent transcriptions equals the Altshuller Foundation 1973 table.

## Principles (in the order the matrix lists them)

| # | Principle | What it means | Software example |
|--:|---|---|---|
| 10 | **Preliminary action** | Carry out the required change, fully or partly, before it is needed. | Precompute results; warm caches; ahead-of-time compilation; pre-pulled images and pre-provisioned environments. |
| 28 | **Mechanics substitution** | Replace the way the parts interact with a different kind of channel or field. | Replace polling with events or webhooks; replace manual review with automated static analysis. |
| 4 | **Asymmetry** | Replace a symmetrical form with an asymmetrical one, or increase existing asymmetry. | Separate read and write paths (CQRS); one writer with many read replicas; asymmetric roles in a protocol. |
| 34 | **Discarding and recovering** | Let parts that have done their job go away or change during operation, and restore used-up parts straight away. | Garbage collection; cache eviction and TTLs; log rotation; automatic cleanup of ephemeral environments; compaction. |

The report goes on with a reminder that principles are prompts for ideas, not solutions, and the reverse cell. triz-matrix analyze methods/triz-matrix/examples/search-api.json does the same for several contradictions at once and ranks the principles that recur (docs/demo/triz-analyze.md). Ambiguous names are rejected with the candidates listed, never guessed.

In Claude Code

/clarent-methods:ach test_checkout_total fails ~1 in 8 CI runs
/clarent-methods:redteam docs/adr-014-event-sourcing.md
/clarent-methods:triz-matrix make /search faster without making it harder to run

The skills are manual-only (disable-model-invocation), so they cost no context until you call them. ach makes the agent list rival causes first, gather evidence by running commands, rate each item against all hypotheses, and re-score until one explanation survives or the diagnosis is declared unresolved.

Methods

Method Tool Status
Analysis of Competing Hypotheses (Heuer, CIA) ach implemented (reference)
Red Teaming (UFMCS) redteam implemented (beta)
TRIZ contradiction matrix (Altshuller) triz-matrix implemented (beta); additional method, outside the top-10 ranking
Statistical Process Control (Shewhart) on CI spc spec
Commander's Intent / Mission Command intent spec
Reference Class Forecasting rcf spec
Kepner-Tregoe IS / IS-NOT kt spec
Heilmeier Catechism gate spec
Fault Tree Analysis fta spec
HAZOP (guide words on APIs and data flows) hazop spec
After Action Review (US Army TC 25-20) aar spec
FMEA, STAMP / STPA fmea, stpa deferred to v2

The ranking is the author's judgment, not a measurement; scores, criteria and the corrections made along the way are in research/ranking.md. 63 methods were catalogued, each source marked read / exists / blocked / unverified: research/.

What we do not claim

  • That a skill makes an agent solve more tasks. gstack (one of the biggest repos in this space) publishes a null result on its own bug-fixing benchmark in its README; we will publish ours, null or not.
  • That the numbers are Heuer's, Shewhart's or Goldratt's. Where a constant is ours (weights, thresholds) the method card says so.
  • That the catalog's sources are all verified. Each one carries its verification level.
  • That the TRIZ matrix data has a clean chain of title. Its licenses and gaps are written down in DATA_LICENSE.md; 29 of its 1 248 cells are contested between transcriptions, and you can supply your own matrix with --data.
  • That the demos are real incidents. The examples are synthetic and labelled so.
  • That the specified methods exist. spc, intent, rcf, kt, gate, fta, hazop and aar are specifications; nothing is promised about when they ship.
  • That the red team's findings are correct. The engine rejects findings that are not quoted from the text or not backed by evidence; whether an attack is right is still a judgment. Three of its six attack classes (scale, dependency, reversibility) are Clarent's own and are not in the UFMCS handbook it draws on.
  • That it works in agents other than Claude Code. The plugin is validated with claude plugin validate; Cursor, Codex and others have not been tested.
  • That the ranking of methods is a measurement, or that its "no existing repo" findings are proof of absence: they are lower bounds from GitHub search.

Contributing

A new method is one folder, one card, one engine, tests and an example. Start with CONTRIBUTING.md; clarent doctor tells you what is missing.

License

Apache-2.0. See LICENSE.

Metadata

Release files for clarent-methods 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clarent-methods 0.1.0
File Size Uploaded Provenance Actions
clarent_methods-0.1.0.tar.gz 340.4 kB With provenance Details for clarent_methods-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clarent-methods 0.1.0
File Interpreter ABI Platform Actions
clarent_methods-0.1.0-py3-none-any.whl Python 3 none any Details for clarent_methods-0.1.0-py3-none-any.whl

Total release size: 484.5 kB

Release files / clarent_methods-0.1.0.tar.gz

Download URL clarent_methods-0.1.0.tar.gz
Size 340.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d1a7d84c481e30c712ab37958ff2bb3bbde7cc9ad0cf69c1d495781e9dc6d12a
BLAKE2b-256 checksum
How to use checksums
782280d8755506971a6379b90e012beb907ed20fae280636795a8f3bed48fc55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / clarent_methods-0.1.0-py3-none-any.whl

Download URL clarent_methods-0.1.0-py3-none-any.whl
Size 144.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9622f704906d3e2c7033f208afec5b126614ae8e711eba388d23524590747557
BLAKE2b-256 checksum
How to use checksums
8d023bc2d85700635f03b5e3d0614a9385c22876970343f9f4b4f8e794f40674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for clarent-methods 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for clarent_methods-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page