mtkit — AI Full-Stack Test Engineer
Plan-first generation of standard XMind test cases (quality-gated), health checks and repair of test case assets, interactive test consulting and issue diagnosis guidance. It learns with every use and matures over time.
Pipeline
flowchart LR
IN[Input: plan.docx + sample.xmind + backend repo + custom docs] --> READ[Read & document health check]
READ --> FACTS[Code facts scan<br/>9 languages / SQL / runtime flows]
READ --> RULES[Document rule tables]
FACTS --> TP[Test point layer<br/>testpoints.json]
RULES --> TP
TP --> PLAN[Test output plan<br/>risk-weighted + builder advice]
PLAN --> AUTH{Authorization}
AUTH -->|confirm| CONTRACT[Contract JSON<br/>tp / asserts traceability]
CONTRACT --> GATE[Quality gate<br/>atoms + review + AI audit]
GATE --> RENDER[Render XMind]
RENDER --> CHECK[Validate + gap comparison]
CHECK --> OUT[Delivery: XMind + defect summary + work traces]
OUT -.feedback.-> MEM[(Project memory<br/>.mtkit-work/memory.db)]
MEM -.recall/reuse.-> PLAN
Judgement & Cognitive Loop (v1.24+)
Beyond the linear pipeline, mtkit keeps a closed loop so it stops behaving like a dumb workflow runner:
flowchart LR
TP[testpoints.json] --> GEN[generate]
PLAN[plan.json<br/>risk + test points] --> GEN
GEN --> CRITIC[critique<br/>atoms: rules + probes + semantic]
CRITIC -->|issues + fix hints| REPAIR[targeted repair]
REPAIR --> CRITIC
CRITIC --> OUT[delivery]
OUT --> LEARN[feedback / diff / defects]
LEARN --> MEM[(memory.db)]
MEM --> GEN
MEM --> EVAL[golden-set metrics]
EVAL -->|regression gate| CI[CI]
| Capability | Command | What it adds |
|---|---|---|
| Tool protocol | any command --json/--trace-id/--ai |
One envelope (ok/data/issues/next_actions/open_questions) + graded exit codes (0/1/2/3/4/5) |
| Test points | mtkit testpoint build/check/show |
First-class requirement points (testpoints.json): 12 kinds, deterministic evidence probes, four-state coverage (covered / weak / uncovered / orphan) |
| Judgement atoms | mtkit atoms list/show/run |
One registry for every check: 10 atoms in 4 groups (contract / probes / coverage / tree) — adding a rule = registering a function |
| Memory | mtkit memory ... |
stdlib SQLite (WAL) storing patterns, corrections, defects, insights, case index; optional embedding re-ranking with automatic degradation |
| Retrieval | automatic | Chinese 2-gram TF-IDF + URL normalization + adoption re-ranking (no deps) |
| Plan & drift | mtkit plan build/authorize/check |
Risk-weighted test points (optionally sourced from --tp), sha256 fingerprint, PLAN_DRIFT checks |
| Workflow gate | mtkit workflow check/show/mark |
state.json progress vs artifact chain: stage order, artifacts exist, plan authorized before generation, WORKFLOW_PLAN_COVERAGE |
| Critique loop | mtkit review, mtkit gen-doc --rounds N |
Deterministic probes (VAGUE_EXPECT/NO_ERROR_PATH/...) + methodology evidence + targeted repair with budget |
| Orchestration | mtkit orchestrate suggest/record/show, mtkit challenge add/list/resolve/reliability |
Complexity-driven sub-brain roster, challenge ledger with adjudication and reliability-based down-ranking |
| Policy | mtkit policy show/learn/verify/merge/rollback/watch |
Bounded self-learning of statistical parameters (proposal → verify → authorized merge → watch rollback) |
| Escape analysis | mtkit check eval --escape [--max-escape 0.2] |
Defect → test point mapping (case declaration → title overlap → kind fallback); escape_rate / untested_rate become CI gates |
| Learning & evaluation | mtkit eval -d dir --gate [--recall/--method], mtkit memory ingest |
Golden-set regression metrics (incl. recall & methodology baselines), CI gate, defect/correction feedback |
| Plugin self-check | mtkit install --check |
Compares the Qoder registry (v1 + v2) installPath/version against the current skill sources; non-zero exit on drift |
Use mtkit capabilities for the machine-readable manifest (inputs, side effects, network cost).
Command Topology: 6 Verbs (v1.24+)
Since v1.24 the CLI is organized as six verb groups. All legacy command names remain valid (mtkit review == mtkit check review), so existing scripts and docs keep working. Running a verb alone prints the group help.
| Verb | Legacy commands | Purpose |
|---|---|---|
scan |
facts testpoint asset diff |
Collect facts: code / requirement points / assets / coverage delta |
plan |
plan |
Test plan artifacts: build / authorize / drift check |
check |
review audit validate eval workflow |
Judgement and gates: contract / asset / structure / evaluation / workflow |
build |
gen gen-doc contract tree info |
Produce and convert: xmind / contract / tree / info |
ledger |
memory track bug challenge |
Ledgers: memory / execution records / defects / challenges |
env |
db redis install capabilities evolve policy orchestrate |
Environment and governance |
mtkit scan # prints the verb group help
mtkit scan facts -r backend -o facts.json # same as: mtkit facts -r backend -o facts.json
mtkit check review -i contract.json --tp testpoints.json
Quick Start (Zero Dependencies)
# 1. Generate XMind (pure standard library, no installation required)
cd <mtkit-repo>
mtkit gen -i examples/sample.json -o cases.xmind
# 2. Validate & inspect
mtkit validate -i cases.xmind
mtkit info -i cases.xmind
Optional dependencies (install only when used): .docx parsing pip install python-docx; .pdf parsing pip install pypdf; .xlsx parsing pip install openpyxl; database drivers are installed on demand by mtkit db install (pymysql / psycopg2 / oracledb ...), Redis clients by mtkit redis install.
One-Click Install (with Qoder plugin registration & optional deps)
# Option 1 (recommended, zero setup on new machines): CLI + bundled skill assets from PyPI
pip install mtkit
mtkit install # copies bundled skills to ~/.mtkit/plugin and registers the Qoder plugin
# Option 2: run in the repo root (editable install, optional deps installed automatically)
python install.py # or double-click install.bat
# Option 3: provide a git URL to fetch and install automatically
python install.py --git <git-url> [--dir target-dir]
After installation, restart Qoder; typing / lists the mtkit plugin (Qoder groups plugin skills under the plugin name). Type /skills to confirm mtkit-gen-xmind is loaded, or just trigger it with natural language.
Upgrading after a PyPI release:
pip install -U mtkit && mtkit installrefreshes both the CLI and the skill files (~/.mtkit/plugin). Plugin registration writes both Qoder registries (installed_plugins.jsonv1 +installed_plugins_v2.json).mtkit install --git <git-url>remains available for repo-based installs and fast-forward pulls the clone first.
Commands
| Command | Purpose | Example |
|---|---|---|
gen |
Contract/data → .xmind | mtkit gen -i contract.json -o cases.xmind |
gen-doc |
Design doc → LLM generation → gate loop → .xmind | mtkit gen-doc -i plan.docx -r backend --llm cli --rounds 2 |
gather |
Plan + samples + code → context | mtkit gather -i plan.docx --hist sample.xmind -r backend -o ctx.json |
facts |
Code facts scan: 9 languages / SQL / enums / middlewares / runtime flows (test sources excluded by default, --include-tests to keep) |
mtkit facts -r backend -o facts.json |
testpoint |
Test point artifact: build/check/show — requirement → case traceability anchors | mtkit testpoint build -d plan.docx -f facts.json |
review |
Contract quality gate (rules + probes + optional semantics) | mtkit review -i contract.json -f facts.json --tp testpoints.json |
atoms |
Judgement atom catalogue: list/show/run | mtkit atoms list |
workflow |
Workflow artifact gate: stage order / artifacts / plan authorization / contract fingerprint | mtkit workflow check --gate |
audit |
Test asset health check (find unfit cases) | mtkit audit -i legacy.xmind -f facts.json |
db |
Read-only DB access: auto-detect (10 dialects), on-demand driver install, multi-DB check/schema/verify (db schema --tables reads only referenced tables) |
mtkit db detect -r backend -o db-detect.json |
redis |
Read-only Redis cache access: usage + local instance auto-detect, on-demand client install, key snapshot | mtkit redis keys -c redis.json -o redis-cache.json |
validate / info |
Validate / inspect .xmind | mtkit validate -i cases.xmind |
diff |
Missed-test gap comparison | mtkit diff -i cases.xmind -f facts.json -d plan.docx |
contract / tree |
Cases ↔ contract conversion / restore tree | mtkit contract -i cases.xmind -o contract.json |
track |
Test management: execution records/reports/trends | mtkit track record --case case --result pass |
bug |
Defect library: add/list/close/stats | mtkit bug add --title defect --severity P1 |
evolve |
Self-evolution: backup/restore/list/cleanup | mtkit evolve backup <file> |
asset |
Test asset aging detection (governance) | mtkit asset stale --dir output-dir --days 30 |
plan |
Test plan artifact: build / authorize / check / show (build --tp aligns ids with test points) |
mtkit plan build -i plan.docx -f facts.json --tp testpoints.json |
eval |
Golden-set regression metrics + CI gate (--recall, --method baselines); --escape [--max-escape] = defect miss metric |
mtkit eval -d assets --gate |
memory |
Project memory: stats/recall/explain/forget/decay/migrate/ingest/feedback/runs/propose/proposals/resolve/embed | mtkit memory recall -q bill status |
learn |
Self-training: run artifacts → TrainingSample v1 → distilled knowledge → memory (run / report / gate); scan testpoint build --with-knowledge feeds gap families back into points |
mtkit ledger learn run --deliver out/ --dry-run |
policy |
Policy artifact: show/learn/verify/merge/rollback/watch (bounded self-learning) | mtkit policy show |
orchestrate |
Complexity-driven sub-brain roster: suggest/record/show | mtkit orchestrate suggest -f facts.json |
challenge |
Sub-brain challenge ledger: add/list/resolve/reliability | mtkit challenge list --status open |
install |
Install/refresh Qoder plugin skills (source mode registers the repo); --check reports registry drift |
mtkit install --check |
capabilities |
Machine-readable self description | mtkit capabilities --json |
Test Point Layer (v1.24+)
Requirement points are first-class entities. mtkit testpoint build merges four sources into testpoints.json (plus historical gap families when --with-knowledge is given):
- document rule tables (status / transition / limits / permission / exception / idempotency / concurrency headers)
- code facts (
enumsplus runtimeflows: MQ producers/consumers, scheduled jobs,@Async,@FeignClient, transaction boundaries) - manual point files (
--points, highest priority)
Each point carries id / kind / source / evidence_required across 12 kinds (functional, state_transition, money_rule, permission, idempotency, concurrency, mq_consume, external_dep, data_integrity, boundary, scheduled, async) and a deterministic evidence probe. Cases declare coverage via tp; mtkit review --tp grades coverage in four states — covered / weak (evidence gap) / uncovered / orphan — with blocking codes TP_NO_CASE / TP_EVIDENCE_GAP / CASE_ORPHAN_TP. WORKFLOW_PLAN_COVERAGE blocks plans that leave registered points out, and mtkit plan build --tp testpoints.json makes the plan use the same ids.
mtkit check eval --escape turns the same traceability into a miss metric: reported defects are mapped back to the test points that should have caught them (case declaration → title overlap → kind fallback), escape_rate counts defects nothing was designed for, untested_rate counts points that were designed but never covered, and --max-escape gates the budget in CI. The contract path can be omitted once state.json has it registered.
Contract format (the single input convention). Cases can declare test-point traceability (tp) and structured assertions (asserts):
{"chapters":[{"t":"Chapter","cases":[{"t":"tc-P0-Functional: case name",
"pc":["preconditions"],"steps":["steps"],"expects":["expected"],
"sql":["SELECT ..."],"method":"equivalence class","risk":"high",
"tp":["TP-STATE_TR-1a2b3c4d"],
"asserts":[{"target":"bill.status","op":"=","value":"PAID","when":"success"}]}]}]}
mtkit contract --spec prints the authoritative schema (single source: mtkit/contract.py).
Database Access (Optional, Strictly Read-Only)
Four data sources in db.json (via the type field):
{"type":"cli","connect":{"cmd":"mysql -h{host} -u{user} -p{pass} {db} -N -e \"{sql}\"","host":"10.0.0.1","user":"ro","pass":"${DB_PASS}","db":"bill_db"}}
{"type":"driver","driver":"pymysql","host":"10.0.0.1","user":"ro","password":"${DB_PASS}","db":"bill_db"}
{"type":"http","url":"https://gw.example.com/query","token":"${DB_TOKEN}"}
{"type":"file","path":"schema.json"}
Only SELECT/EXPLAIN/DESC/SHOW are allowed; all write operations are rejected. Passwords use ${ENV_VAR} environment variables.
Schema is read on demand: mtkit db schema --tables t1,t2 fetches only the tables referenced by the feature SQL instead of scanning the whole database.
Layered Architecture (v1.24+)
Eight layers, each depending only on the ones below it. Adding a judgement means touching one layer, not all of them.
graph TB
A["Command surface<br/>cli/ 11 files"] --> B["Operator layer<br/>atoms + operators (10)"]
B --> C["Judgement layer<br/>review / coverage / probes / testpoint / escape"]
C --> D["Collection layer<br/>extract: code_facts + doc_facts + flow_facts"]
D --> E["Access layer<br/>db/providers + db_catalog + redis_cache"]
C --> F["View layer<br/>views (3 views)"]
A --> G["Ledger layer<br/>memory / track / feedback"]
A --> H["Learning layer<br/>brain/learn (5 modules)"]
H -.distill.-> G
H -.gap kinds.-> C
G -.recall.-> C
| Layer | Files | Responsibility |
|---|---|---|
| Command surface | cli/ (11 modules) |
argparse, 6 verb entries, legacy alias compatibility |
| Operator layer | atoms.py, operators.py |
Atom / Context / Registry / Result framework + 10 built-in judgement atoms |
| Judgement layer | review.py, coverage.py, probes.py, testpoint.py, brain/escape.py |
contract gate, coverage grading, evidence words, test points, escape-rate metrics |
| Collection layer | extract/ (code_facts/, doc_facts.py, flow_facts.py, doc loaders, xmind_loader.py) |
facts from code / docs / runtime flows |
| Access layer | db/ (providers/, config.py, schema.py, sql.py), db_catalog.py, redis_cache.py |
read-only data source access with on-demand drivers |
| View layer | views.py |
3 report primitives (issue / coverage / artifact) + layered rendering: describe_* produce data specs, views.render(spec) does layout |
| Ledger layer | brain/memory.py, track.py, brain/feedback.py (+ retrieve.py / embed.py) |
memory store, execution records, feedback distillation, recall |
| Learning layer | brain/learn/ (parsers, sample, distill, report, pipeline) |
run artifacts → TrainingSample v1 → knowledge candidates → memory; learning gate (adoption / recurrence) |
Dependencies only point downwards (surface → operator → judgement → collection → access); views, the ledger and the learning layer are cross-cutting. Adding a check means registering an operator (mtkit/operators.py) and, if needed, an evidence word entry (mtkit/probes.py) — no edits scattered across review/critic/testpoint.
Learning loop (v1.24.4) — every finished delivery feeds the ledger instead of dying in a markdown file:
工作痕迹 + 缺陷点与建议 + 门禁/覆盖报告 + plan/契约/testpoints/testdb
→ TrainingSample v1 (.mtkit-work/runs/<run_id>/sample.json, fingerprint-idempotent)
→ 5 knowledge kinds correction / defect / insight / pattern / gap
→ memory.db 已裁决 + 必须带证据 + (kind,key) 唯一 + 冲突进裁决
→ 下一轮消费 plan 风险加权 · testpoint --with-knowledge 补缺口族 · 契约修正模式召回
mtkit ledger learn run|report|gate:数字只从机器产物取(gate 轮次/问题码/逃逸率),散文只提供标签与理由;改代码类自迭代(L2)只写提案,需人授权 + 单测。
Full tree:
mtkit/
├── cli/ command surface + argparse (verbs, parser, scan, plan, check, build, ledger, env, atoms, _shared)
├── atoms.py atom framework (Atom / Context / Registry / Result): unified issue shape, grouped runs
├── operators.py built-in judgement catalogue: STRUCTURE / SQL_TRACEABILITY / SQL_COLUMNS / METHODOLOGY / PROBES / TP_COVERAGE + tree atoms
├── review.py contract gate composed from operator runs
├── coverage.py feature/interface coverage comparison and grading
├── probes.py single evidence word table + evaluator shared by review / critic / testpoint
├── testpoint.py test point layer (kinds, evidence probes, coverage)
├── views.py shared report views: issue table / coverage table / artifact table
├── audit.py asset health check (tree atoms)
├── extract/ doc_loader dispatch (docx/md/txt/html/pdf/xlsx/csv), code_facts, flow_facts, doc_facts
├── db/ read-only data sources: providers (cli/driver/http/file), config, schema, sql, install
├── brain/ plan, critic, workflow, orchestration, adjudication, memory, retrieve, embed, policy, eval, feedback, loop, escape, learn/
├── generate/ skeleton + LLM generation (prompts, llm)
├── track.py execution / defect ledger with feedback ingestion
├── db_catalog.py, redis_cache.py read-only data source access (on-demand drivers)
└── contract.py, parsers.py, normalize.py, writer.py, formats.py contract & xmind IO
Qoder Integration (2 Steps)
- Qoder plugin manager → local plugin → select
<mtkit-repo> - Chat prompts:
- Generate cases: "Use mtkit to generate XMind test cases: plan xxx.docx, sample xxx.xmind, backend repo xxx"
- Test consulting: "How should I test this feature?" / "The production error, help me look into it" / "Is this a bug?"
Skill Sequence
sequenceDiagram
participant U as User
participant A as AI (test builder)
U->>A: Provide the three inputs + optional docs/db
A->>U: Document health check (defects + advice, confirm item by item)
A->>A: gather + facts + testpoints + experience library loading
A->>U: Test case output plan (design methods + builder advice)
U->>A: Authorization (can add/remove/adjust)
A->>A: Generate contract → atoms gate → fix loop
A->>U: Case adjustment suggestions (confirm item by item)
A->>A: Render XMind → validate → gap comparison
A->>U: Delivery (XMind / defect summary / work traces) + training
Iterative Updates (Editable Install, No Reinstall Needed)
pip install --force-reinstall --no-deps -e <mtkit-repo> # only when needed
python -m unittest # self-check
- Plugin side: repo file updates take effect immediately; only
plugin.jsonversion changes require a Qoder restart - Self-iteration: improvements discovered by the AI during use are written to
.mtkit-work/improvements.json; withauto_improveenabled in.mtkit.jsonand authorization granted, the AI can optimize itself and self-verify (see skills docs) - Details: see CHANGELOG.md and skills/mtkit-gen-xmind/ (skills & conventions)
PyPI Release (Maintainer Guide)
# 1. Build
python -m pip install build twine
python -m build # produces dist/mtkit-<version>.tar.gz + .whl
python scripts/check_dist.py # latest wheel/sdist: no tests/ paths, plugin assets present
# 2. Recommended: verify on TestPyPI first
python -m twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/simple/ mtkit
mtkit --help # verify the CLI
# 3. Publish officially after verification (requires project-level API token + PyPI account 2FA)
python -m twine upload dist/* # enter API token
tests/ never ships: pyproject.toml excludes tests* from the wheel, MANIFEST.in prunes it from the sdist, .gitattributes marks it export-ignore, and scripts/check_dist.py fails the release (and CI build job) if any test path slips in.
Installation flow for new teammates after release (final form):
pip install mtkit # CLI + bundled skill assets (pure stdlib, installs in seconds)
mtkit install # registers the repo as installPath (source mode) or copies bundled skills
mtkit install --check # registry vs source drift check; non-zero exit when stale
# restart Qoder → / lists the mtkit plugin; /skills shows mtkit-gen-xmind
# upgrade later
pip install -U mtkit && mtkit install
Metadata
Release files for mtkit 1.24.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mtkit-1.24.4.tar.gz | 292.4 kB | Without provenance | Details for mtkit-1.24.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mtkit-1.24.4-py3-none-any.whl | Python 3 | none | any | Details for mtkit-1.24.4-py3-none-any.whl |
Total release size: 635.6 kB
Release files / mtkit-1.24.4.tar.gz
| Download URL | mtkit-1.24.4.tar.gz |
|---|---|
| Size | 292.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fa19683e6b01b1e3d2a1ec8fb2d81fabf276cac70e98017ef2297a8744cf062
|
|
BLAKE2b-256 checksum How to use checksums |
c66fac21fb9029fac625fc4f257a655ed8c1b4f6ed12ee57189f52ba92d0d6e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.7
|
Release files / mtkit-1.24.4-py3-none-any.whl
| Download URL | mtkit-1.24.4-py3-none-any.whl |
|---|---|
| Size | 343.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aa18eb43f1081e0d4815b8e3f2974c9f06471e1548d255e613a96ed80568728
|
|
BLAKE2b-256 checksum How to use checksums |
cc2d0c94bbd4b2281a154e19007e00e965081ed8f5c3f2882821160f589bcd65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.7
|
Security for mtkit 1.24.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.