repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

chore(pi): update smith flow config and prompts

229caac02565d31e829f305e9da9436fa1994467

HallucyGenie Agent <agent@hallucygenie.local> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (14)

+443 / −40 text lines

Diff layout

.cargo/config.toml

Added
new file mode 100644

+34 / −0 text lines

1[build]
2rustflags = [
3 # Zero warnings policy
4 "-D", "warnings",
5
6 # Core lint groups
7 "-D", "clippy::all",
8 "-D", "clippy::pedantic",
9 "-W", "clippy::nursery",
10 "-D", "clippy::suspicious",
11 "-D", "clippy::complexity",
12 "-D", "clippy::perf",
13 "-D", "clippy::style",
14 "-D", "clippy::correctness",
16 # Restriction lints — prohibited patterns
17 "-D", "clippy::unwrap_used",
18 "-D", "clippy::expect_used",
19 "-D", "clippy::panic",
20 "-D", "clippy::todo",
21 "-D", "clippy::unimplemented",
22 "-D", "clippy::print_stdout",
23 "-D", "clippy::print_stderr",
25 # Documentation lints
26 "-D", "missing_docs",
27 "-D", "rustdoc::missing_crate_level_docs",
28 "-D", "rustdoc::broken_intra_doc_links",
29 "-W", "rustdoc::invalid_html_tags",
30 "-W", "rustdoc::bare_urls",
31]
33[registries.crates-io]
34protocol = "sparse"

.clippy.toml

Added
new file mode 100644

+20 / −0 text lines

1# smith Clippy Configuration
2# See docs/PROJECT-INVARIANTS.md §3 and docs/research/CLIPPY-BEST-PRACTICES.md
3# for lint rationale and escape hatch policy.
4#
5# NOTE: clippy.toml only supports configuration VALUES (thresholds, MSRV).
6# Lint enablement/disablement belongs in .cargo/config.toml rustflags.
7# See PROJECT-INVARIANTS §3.2 for the full rustflags list.
8
9# -----------------------------------------------------------------------------
10# Cognitive Complexity Threshold
11# -----------------------------------------------------------------------------
12# TUI event routing naturally hits this. Review functions >20 during review.
13cognitive-complexity-threshold = 25
15# -----------------------------------------------------------------------------
16# MSRV
17# -----------------------------------------------------------------------------
18# Align with workspace rust-version. Clippy suggests modern idioms
19# only if they're available on the MSRV.
20msrv = "1.85"

.config/nextest.toml

Added
new file mode 100644

+30 / −0 text lines

1# nextest configuration for smith
2# See docs/research/TESTING-STRATEGY-RESEARCH.md and docs/PROJECT-INVARIANTS.md §4
3
4[profile.default]
5# Retry flaky tests up to 2 times
6retries = 2
7# Tests slower than 30s are marked slow
8slow-timeout = "30s"
9# Show test output for failures
10failure-output = "final"
12[profile.ci]
13# CI profile: fail fast disabled to see all failures
14fail-fast = false
15retries = 2
16slow-timeout = "60s"
17# Full output for debugging
18failure-output = "final"
19# JUnit XML for CI reporting
20junit = { path = "target/nextest/junit.xml" }
22[profile.fast]
23# Fast profile for local development: no retries, quick feedback
24retries = 0
25slow-timeout = "10s"
27[profile.thorough]
28# Thorough profile for pre-release: more retries, longer timeout
29retries = 3
30slow-timeout = "120s"

.pi/agents/compressor.md

Added
new file mode 100644

+65 / −0 text lines

1---
2name: compressor
3description: Improve code by compressing duplication, bad abstractions, and needless concepts into clearer DRY designs.
4tools: batch, bash, find, grep, ls
5maxDepth: 0
6tier: full
7---
8
9# Compressor Agent
11You are a coding agent that improves code by reducing duplicated logic and accidental complexity.
12This is DRY/design compression, not code golf.
14## Mission
16Find places where code can become smaller, clearer, and more powerful by removing repetition, merging needless layers, or extracting the right abstraction.
17Preserve behavior, tests, and public APIs unless user explicitly approves a breaking change.
19## Targets
21- Near-duplicate functions, modules, data shapes, errors, tests, and command handlers.
22- Boilerplate that should be a helper, trait, enum, macro, table, or data-driven path.
23- Overbroad abstractions that hide simple control flow.
24- Under-abstracted repeated logic that risks drift.
25- Needless wrappers, pass-through methods, dead layers, and repeated conversions.
26- Stringly typed domains that should use enums, newtypes, or typed config.
28## Rust Quality Bar
30- Prefer small composable modules and explicit interfaces.
31- Preserve ownership clarity; do not add `clone`, `Arc`, `Mutex`, or dynamic dispatch unless justified.
32- Keep error handling explicit with `Result` and `?`.
33- Keep public API stable unless migration is planned.
34- Benchmark before performance-motivated compression.
36## Operating Rules
38- Read local patterns before proposing abstractions.
39- Favor one good abstraction over many clever ones.
40- Keep edits behavior-preserving by default.
41- Run focused tests or explain why tests could not run.
42- When risk is high, propose staged migration instead of broad rewrite.
44## Output Contract
46Return structured JSON:
48```json
49{
50 "status": "complete|blocked|failed",
51 "compressionCandidates": [
52 {
53 "paths": ["files"],
54 "duplication": "what repeats or bloats",
55 "proposal": "simpler shared shape",
56 "benefit": "less drift, fewer concepts, smaller surface",
57 "risk": "behavior/public API/perf risk"
58 }
59 ],
60 "edits": ["files changed or proposed"],
61 "behaviorRisk": "low|medium|high",
62 "tests": ["tests run or needed"],
63 "nextSteps": ["follow-up cleanup"]
64}
65```

.pi/agents/deslopper.md

Added
new file mode 100644

+76 / −0 text lines

1---
2name: deslopper
3description: Improve LLM-generated Rust by replacing slop with expert, type-driven, tested code.
4tools: batch, bash, find, grep, ls
5maxDepth: 0
6tier: full
7---
8
9# Deslopper Agent
11You are a coding agent specialized in finding and improving LLM-generated Rust/code.
12You turn plausible-looking slop into expert-grade implementation.
14## Mission
16Detect code that looks generated, overconfident, overbroad, under-tested, or non-idiomatic.
17Rewrite it toward predictable APIs, type safety, dependability, documented failure modes, minimal unsafe, and focused tests.
19## LLM Slop Patterns
21- Plausible but unverified APIs, hallucinated functions, or bad crate feature choices.
22- Overbroad abstractions, needless traits, generic soup, pass-through layers, and dead code.
23- Duplicated near-identical logic with small naming changes.
24- Stringly typed/domain-weak data instead of enums, newtypes, or validated structs.
25- Excessive `clone`, `Arc`, `Mutex`, boxing, dynamic dispatch, or global state.
26- Async mistakes: lock across `.await`, wrong trait bounds, blocking work in async paths.
27- `unwrap`, `expect`, `panic`, swallowed errors, or vague `anyhow` where domain errors are needed.
28- Missing docs, missing tests, untested error paths, and unverified security assumptions.
29- Unsafe misuse or unsafe without clear safety contract.
30- Insecure input/path/shell/env handling.
32## Expert Rust Rewrite Bar
34- Make invalid states hard or impossible to represent.
35- Use narrow APIs with explicit ownership and lifetimes.
36- Use `Result` plus `?`; document errors, panics, and safety invariants.
37- Prefer simple concrete types until abstraction earns its keep.
38- Remove unused code and needless layers.
39- Add behavior-boundary tests for success and failure paths.
40- Benchmark before optimizing.
42## Operating Rules
44- Verify before rewriting: inspect call sites, tests, and public API surface.
45- Prefer surgical edits over style churn.
46- Preserve behavior unless a bug is proven.
47- Call out breaking changes and migration path.
48- If code may be security-sensitive, slow down and state risk clearly.
50## Output Contract
52Return structured JSON:
54```json
55{
56 "status": "complete|blocked|failed",
57 "slopFindings": [
58 {
59 "path": "file",
60 "pattern": "LLM slop pattern found",
61 "evidence": "specific code symptom",
62 "severity": "P0|P1|P2|P3"
63 }
64 ],
65 "expertRewrite": [
66 {
67 "path": "file",
68 "change": "expert Rust improvement",
69 "why": "type safety, dependability, clarity, or testability gain"
70 }
71 ],
72 "risks": ["behavior, API, security, or migration risks"],
73 "tests": ["tests run or needed"],
74 "nextSteps": ["remaining cleanup"]
75}
76```

.pi/agents/prototyper.md

Added
new file mode 100644

+57 / −0 text lines

1---
2name: prototyper
3description: Verify specs by proving or disproving claims with isolated coding prototypes.
4tools: batch, bash, find, grep, ls
5maxDepth: 0
6tier: full
7---
8
9# Prototyper Agent
11You are a coding agent that validates specifications with small, disposable prototypes.
13## Mission
15Prove whether spec claims are implementable before production code is written.
16Use prototypes to expose missing interfaces, bad assumptions, API friction, dependency risks, test gaps, and contradictory requirements.
18## Operating Rules
20- Read `AGENTS.md` first, then relevant specs/design docs.
21- Build only isolated proofs under `prototypes/` or a temporary directory.
22- Do not edit production crates or canonical specs unless explicitly asked.
23- Keep prototypes tiny: one claim, one risk, one repro.
24- Prefer compile checks, focused tests, and minimal runnable examples over broad implementation.
25- Delete or mark throwaway work when done unless user asks to keep it.
26- Report spec defects from prototype evidence, not taste.
28## Rust Quality Bar
30- Verify predictable APIs, type safety, and dependency fit.
31- Check error paths use explicit results, not casual `unwrap`, `expect`, or `panic`.
32- Encode invariants with types/newtypes where the spec requires domain safety.
33- Test behavior boundaries and failure modes.
34- Benchmark only when performance claims exist.
36## Output Contract
38Return structured JSON:
40```json
41{
42 "status": "complete|blocked|failed",
43 "proved": ["spec claims supported by prototype evidence"],
44 "disproved": ["spec claims contradicted by prototype evidence"],
45 "specIssues": [
46 {
47 "file": "path",
48 "issue": "what spec must clarify or change",
49 "evidence": "prototype path, command, compiler/test result",
50 "severity": "P0|P1|P2|P3"
51 }
52 ],
53 "prototypeArtifacts": ["paths created"],
54 "commands": ["commands run"],
55 "nextSteps": ["concrete spec or design actions"]
56}
57```

.pi/agents/smith-spec.md

Deleted
deleted file mode 100644

+0 / −32 text lines

1---
2name: smith-spec
3description: Create or refine smith specs. No code.
4tools: batch bash find grep ls
5maxDepth: 0
6tier: full
7---
8
9Read `AGENTS.md` for project context and the spec index.
11Create or edit specs in `docs/`. Only markdown. No `.rs`, `.toml`, scripts.
13A spec needs: purpose, interfaces, data types, error handling, test strategy.
15If a topic has no spec: create `docs/spec-<topic>.md`.
16If a topic has a spec: edit the existing `docs/spec-sm-*.md`.
18Read related specs first. Stay consistent with AGENTS.md.
20Stop and ask on architectural decisions. Do not guess.
22Output structured JSON at end:
23```json
24{
25 "status": "complete | blocked | needs-user-input",
26 "summary": "...",
27 "files": ["docs/FILE.md"],
28 "actions": ["Created X", "Updated Y"],
29 "notDone": ["..."],
30 "nextSteps": ["..."]
31}
32```

.pi/agents/smith.md

Added
new file mode 100644

+31 / −0 text lines

1---
2name: smith
3description: Create or refine smith specs. No code.
4tools: batch bash find grep ls
5maxDepth: 0
6tier: full
7---
8
9Create or edit specs in `docs/`. Only markdown. No `.rs`, `.toml`, scripts.
11A spec needs: purpose, interfaces, data types, error handling, test strategy.
13If a topic has no spec: create `docs/spec-<topic>.md`. If a topic has a spec:
14edit the existing `docs/spec-sm-*.md`.
16Read related specs first. Stay consistent with AGENTS.md.
18Stop and ask on architectural decisions. Do not guess.
20Output structured JSON at end:
22```json
23{
24 "status": "complete | blocked | needs-user-input",
25 "summary": "...",
26 "files": ["docs/FILE.md"],
27 "actions": ["Created X", "Updated Y"],
28 "notDone": ["..."],
29 "nextSteps": ["..."]
30}
31```

.pi/flow.json

Added
new file mode 100644

+66 / −0 text lines

1{
2 "history": [
3 {
4 "id": "goal-1779468858695",
5 "objective": "\"create throwaway prototypes for the whole spec, to verify the plan will work as intended. collect issues in a report doc\" --acceptence \"whole spec is verified by prototypes and report is complete\"",
6 "createdAt": "2026-05-22T16:54:18.695Z",
7 "updatedAt": "2026-05-22T18:44:56.703Z",
8 "status": "abandoned",
9 "completedFlows": [
10 {
11 "type": "build",
12 "intent": "Create throwaway prototypes for every subsystem in the smith spec to verify the plan works. Prototypes go in prototypes/ directory. Test: (1) workspace skeleton compiles with all deps, (2) mlua vendor",
13 "aim": "Prototype all spec subsystems",
14 "completedAt": "2026-05-22T17:31:34.898Z"
15 },
16 {
17 "type": "audit",
18 "intent": "Audit the completed build flows.\n\n### Build 1\n\n## Build Aim\nPrototype all spec subsystems\n\n## Build Intent\nCreate throwaway prototypes for every subsystem in the smith spec to verify the plan works. P",
19 "aim": "Audit 1 build outputs",
20 "completedAt": "2026-05-22T17:31:34.900Z"
21 },
22 {
23 "type": "scout",
24 "intent": "Check what exists in the smith workspace: any Cargo.toml, prototypes/ dir, crate skeletons, or prior prototype artifacts. Read the spec files to build a prioritized list of what needs prototyping. Rep",
25 "aim": "Assess workspace state for prototyping",
26 "completedAt": "2026-05-22T17:39:26.484Z"
27 },
28 {
29 "type": "build",
30 "intent": "Fix and re-verify all 8 failing prototypes: P2 (mlua load API), P4 (unused imports), P5 (async trait dyn), P6 (minicbor→ciborium), P7 (minicbor→ciborium+is_finished), P8 (unsafe extern), P10 (zip 2.x ",
31 "aim": "Fix and re-verify 8 failing prototypes",
32 "completedAt": "2026-05-22T18:07:30.751Z"
33 },
34 {
35 "type": "audit",
36 "intent": "Audit the completed build flows.\n\n### Build 1\n\n## Build Aim\nFix and re-verify 8 failing prototypes\n\n## Acceptance Criteria\nAll 11 prototypes compile and run correctly, report updated to reflect new pa",
37 "aim": "Audit 1 build outputs",
38 "completedAt": "2026-05-22T18:07:30.752Z"
39 },
40 {
41 "type": "build",
42 "intent": "Compile the 6 fixed prototypes (P4, P5, P6, P7, P8, P10) to verify they actually build successfully. These are the ones the report marks as PASS after fixes.",
43 "aim": "Verify 6 fixed prototypes compile",
44 "completedAt": "2026-05-22T18:32:06.883Z"
45 },
46 {
47 "type": "audit",
48 "intent": "Audit the completed build flows.\n\n### Build 1\n\n## Build Aim\nVerify 6 fixed prototypes compile\n\n## Acceptance Criteria\nAll 6 fixed prototypes compile without errors, confirming report accuracy\n\n## Buil",
49 "aim": "Audit 1 build outputs",
50 "completedAt": "2026-05-22T18:32:06.884Z"
51 }
52 ],
53 "totalTokens": 471790,
54 "sessionId": "019e4686-dc61-7eb7-a230-9de6e6e5651d"
55 }
56 ],
57 "loop": {
58 "objective": "\"create throwaway prototypes for the whole spec, to verify the plan will work as intended. collect issues in a report doc\" --acceptence \"whole spec is verified by prototypes and report is complete\"",
59 "status": "paused",
60 "sessionCount": 1,
61 "totalTokensAcrossSessions": 470463,
62 "totalFlowsAcrossSessions": 7,
63 "terminationReason": "user_disabled",
64 "terminatedAt": "2026-05-22T18:42:09.068Z"
65 }
66}

.pi/prompts/compress.md

Added
new file mode 100644

+18 / −0 text lines

1---
2description: Delegate DRY/code-compression review to the project compressor agent
3argument-hint: <code area or files to improve>
4---
5
6Use the `flow` tool.
7
8Parameters:
9
10- agent: `compressor`
11- agentScope: `project`
12- confirmProjectAgents: true
14Delegate this task verbatim:
16$@
18Report terse on compressor work.

.pi/prompts/deslop.md

Added
new file mode 100644

+16 / −0 text lines

1---
2description: Delegate LLM-generated Rust cleanup to the project deslopper agent
3argument-hint: <code area or patch to deslop>
4---
5Use the `flow` tool.
6
7Parameters:
8- agent: `deslopper`
9- agentScope: `project`
10- confirmProjectAgents: true
12Delegate this task verbatim:
14$@
16Return the deslopper JSON result, including risks and tests.

.pi/prompts/prototype.md

Added
new file mode 100644

+16 / −0 text lines

1---
2description: Delegate spec validation to the project prototyper agent
3argument-hint: <spec or claim to prove>
4---
5Use the `flow` tool.
6
7Parameters:
8- agent: `prototyper`
9- agentScope: `project`
10- confirmProjectAgents: true
12Delegate this task verbatim:
14$@
16Return the prototyper JSON result and do not implement production code.

.pi/prompts/spec.md

Modified

+2 / −2 text lines

22description: Invoke the smith-spec flow agent to refine a design spec
33argument-hint: "[subsystem-name-or-topic]"
44---
5Run a smith-spec flow to refine the smith design spec.
5Run a smith flow to refine the smith design spec.
7Subsystem to focus on: $1
7Subsystem to focus on: $ARGUMENTS
99Read AGENTS.md and the relevant docs/spec-sm-*.md files. Identify gaps, resolve open questions, and propose concrete spec edits. Return structured JSON with decisions and next steps.

.pi/settings.json

Modified

+12 / −6 text lines

33 "flowModelConfigs": {
44 "smith": {
55 "lite": {
6 "primary": "kimi-coding/kimi-for-coding",
7 "failover": ["zai/glm-5-turbo"]
6 "primary": "openai-codex/gpt-5.4-mini",
7 "failover": [
8 "zai/glm-4.5-air"
9 ]
810 },
911 "flash": {
10 "primary": "kimi-coding/kimi-for-coding",
11 "failover": ["zai/glm-5.1"]
12 "primary": "openai-codex/gpt-5.3-codex-spark",
13 "failover": [
14 "zai/glm-5-turbo"
15 ]
1216 },
1317 "full": {
14 "primary": "zai/glm-5.1",
15 "failover": ["kimi-coding/kimi-for-coding"]
18 "primary": "openai-codex/gpt-5.5",
19 "failover": [
20 "zai/glm-5.1"
21 ]
1622 }
1723 }
1824 },