Skip to content

Commit 612a5ef

Browse files
hyperpolymathclaude
andcommitted
docs: bespoke documentation for K9 contract toolchain
Replace template placeholders with k9iser-specific content throughout: - README.adoc: K9 contract anatomy (must/trust/dust/intend pillars), safety tiers (Kennel/Yard/Hunt), use cases, architecture diagram - ROADMAP.adoc: Phase 0-6 from scaffold through ecosystem integration - TOPOLOGY.md: module map, data flow, FFI boundary table - Idris2 ABI: K9Contract, Constraint, MustRule, TrustSource, DustRule, IntendDeclaration, ValidationResult, SafetyTier, ConfigFormat types with dependent-type proofs - Zig FFI: config parsing, constraint inference, contract generation, validation, and attestation functions with k9iser_ prefix - 0-AI-MANIFEST.a2ml: domain-specific invariants for K9 contracts - All .machine_readable/6a2/ files: bespoke STATE, META, ECOSYSTEM, AGENTIC, NEUROSYM, PLAYBOOK Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 799331d commit 612a5ef

17 files changed

Lines changed: 2362 additions & 493 deletions

File tree

.machine_readable/6a2/AGENTIC.a2ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# AGENTIC.a2ml — AI agent constraints and capabilities
4+
# AGENTIC.a2ml — AI agent constraints and capabilities for k9iser
55
# Defines what AI agents can and cannot do in this repository.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[agent-permissions]
1212
can-edit-source = true
@@ -22,6 +22,8 @@ can-create-files = true
2222
# - Never use banned languages (TypeScript, Python, Go, etc.)
2323
# - Never place state files in repository root (must be in .machine_readable/)
2424
# - Never use AGPL license (use PMPL-1.0-or-later)
25+
# - Never generate K9 contracts missing any of the four pillars (must/trust/dust/intend)
26+
# - Never assign a safety tier higher than needed (prefer Kennel over Yard over Hunt)
2527

2628
[maintenance-integrity]
2729
fail-closed = true

.machine_readable/6a2/ECOSYSTEM.a2ml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@
66
(version "0.1.0")
77
(name "k9iser")
88
(type "tool")
9-
(purpose "Wrap configs into self-validating K9 contracts")
9+
(purpose "Analyse config files, infer constraints, generate K9 contracts, validate and attest compliance")
1010

1111
(position-in-ecosystem
1212
(family "-iser acceleration frameworks")
1313
(meta-framework "iseriser")
1414
(relationship "sibling")
15+
(role "K9 contract toolchain — the canonical tool for generating and validating K9 contracts")
1516
(top-3 ("typedqliser" "chapeliser" "verisimiser")))
1617

1718
(related-projects
19+
(project "contractile"
20+
(relationship "upstream-consumer")
21+
(description "CLI contract system — k9iser generates contracts that contractile validators consume"))
1822
(project "iseriser"
1923
(relationship "meta-framework")
2024
(description "Generates new -iser project scaffolding"))
@@ -27,12 +31,12 @@
2731
(project "verisimiser"
2832
(relationship "sibling-priority-3")
2933
(description "VeriSimDB octad database augmentation"))
30-
(project "squeakwell"
31-
(relationship "sibling")
32-
(description "Database recovery via constraint propagation"))
3334
(project "proven"
3435
(relationship "dependency")
3536
(description "Shared Idris2 verified library"))
3637
(project "typell"
3738
(relationship "dependency")
38-
(description "Type theory engine"))))
39+
(description "Type theory engine"))
40+
(project "boj-server"
41+
(relationship "integration-target")
42+
(description "MCP server — k9iser will ship as a BoJ cartridge"))))

.machine_readable/6a2/META.a2ml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,59 @@
44

55
(meta
66
(version "0.1.0")
7-
(last-updated "2026-03-20")
7+
(last-updated "2026-03-21")
88

99
(architecture-decisions
1010
(adr "001-iser-pattern"
1111
(status "accepted")
12-
(context "Need to make powerful languages accessible without steep learning curves")
13-
(decision "Use manifest-driven code generation: user describes WHAT, tool generates HOW")
14-
(consequences "Users write zero target language code; all complexity in the -iser"))
12+
(context "Need to make K9 contract generation accessible without deep knowledge of contract internals")
13+
(decision "Use manifest-driven code generation: user points at configs, k9iser generates contracts")
14+
(consequences "Users write zero K9 contract code by hand; all complexity in k9iser"))
1515

1616
(adr "002-abi-ffi-standard"
1717
(status "accepted")
18-
(context "Need verified interop between Rust CLI, target language, and user code")
19-
(decision "Idris2 ABI for formal proofs, Zig FFI for C-ABI bridge")
18+
(context "Need verified interop between Rust CLI, validation engine, and K9 contract model")
19+
(decision "Idris2 ABI for formal proofs of constraint soundness, Zig FFI for C-ABI bridge")
2020
(consequences "Compile-time correctness guarantees; zero runtime overhead from proofs"))
2121

2222
(adr "003-rsr-template"
2323
(status "accepted")
2424
(context "Need consistent project structure across 29+ -iser repos")
2525
(decision "All repos cloned from rsr-template-repo with full CI/CD and governance")
26-
(consequences "17 workflows, SECURITY.md, CONTRIBUTING, bot directives from day one")))
26+
(consequences "17 workflows, SECURITY.md, CONTRIBUTING, bot directives from day one"))
27+
28+
(adr "004-four-pillars"
29+
(status "accepted")
30+
(context "K9 contracts need a clear structure that maps to the contractile CLI validators")
31+
(decision "Every K9 contract contains four pillars: must, trust, dust, intend")
32+
(consequences "Generated contracts are directly consumable by contractile must/trust/dust/intend validators"))
33+
34+
(adr "005-safety-tiers"
35+
(status "accepted")
36+
(context "Different configs have different risk profiles — deployment configs vs. logging configs")
37+
(decision "Three safety tiers: Kennel (read-only), Yard (write files), Hunt (mutate live)")
38+
(consequences "Users can gate dangerous operations; CI/CD can enforce tier limits"))
39+
40+
(adr "006-multi-format"
41+
(status "accepted")
42+
(context "Real-world projects use a mix of TOML, YAML, JSON, and Nickel configs")
43+
(decision "Support all four formats via a unified config AST")
44+
(consequences "One constraint inference engine works across all formats; no format lock-in")))
2745

2846
(development-practices
29-
(language "Rust" (purpose "CLI and orchestration"))
30-
(language "Idris2" (purpose "ABI formal proofs"))
31-
(language "Zig" (purpose "FFI C-ABI bridge"))
47+
(language "Rust" (purpose "CLI, orchestration, config parsing, constraint inference, codegen"))
48+
(language "Idris2" (purpose "ABI formal proofs — constraint soundness, layout correctness"))
49+
(language "Zig" (purpose "FFI C-ABI bridge — validation engine hot path"))
50+
(language "Nickel" (purpose "K9 contract output format (.k9.ncl)"))
3251
(build-tool "cargo")
3352
(ci "GitHub Actions (17 workflows)"))
3453

3554
(design-rationale
36-
(principle "Manifest-driven"
37-
(explanation "User intent captured in TOML; all generation is deterministic and reproducible"))
55+
(principle "Implicit-to-explicit"
56+
(explanation "Turn implicit config assumptions into explicit, machine-checked K9 contracts"))
57+
(principle "Four pillars"
58+
(explanation "must/trust/dust/intend gives complete coverage of constraint, provenance, hygiene, and intent"))
3859
(principle "Formally verified bridges"
39-
(explanation "Idris2 dependent types prove interface correctness at compile time"))
40-
(principle "Zero target language exposure"
41-
(explanation "Users never write Chapel/Julia/Futhark/etc. — the -iser handles everything"))))
60+
(explanation "Idris2 dependent types prove constraint completeness and soundness at compile time"))
61+
(principle "Contractile compatibility"
62+
(explanation "Generated contracts are first-class inputs to the contractile CLI validator chain"))))

.machine_readable/6a2/NEUROSYM.a2ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# NEUROSYM.a2ml — Neurosymbolic integration metadata
4+
# NEUROSYM.a2ml — Neurosymbolic integration metadata for k9iser
55
# Configuration for Hypatia scanning and symbolic reasoning.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[hypatia-config]
1212
scan-enabled = true
1313
scan-depth = "standard" # quick | standard | deep
1414
report-format = "logtalk"
1515

1616
[symbolic-rules]
17-
# Custom symbolic rules for this project
17+
# Custom symbolic rules for k9iser
1818
# - { name = "no-unsafe-ffi", pattern = "believe_me|unsafeCoerce", severity = "critical" }
19+
# - { name = "four-pillars-present", pattern = "must.*trust.*dust.*intend", severity = "high" }
20+
# - { name = "tier-assignment", pattern = "Kennel|Yard|Hunt", severity = "medium" }
1921

2022
[neural-config]
2123
# Neural pattern detection settings

.machine_readable/6a2/PLAYBOOK.a2ml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
4-
# PLAYBOOK.a2ml — Operational playbook
4+
# PLAYBOOK.a2ml — Operational playbook for k9iser
55
# Runbooks, incident response, deployment procedures.
66

77
[metadata]
88
version = "0.1.0"
9-
last-updated = "{{CURRENT_DATE}}"
9+
last-updated = "2026-03-21"
1010

1111
[deployment]
12-
# method = "gitops" # gitops | manual | ci-triggered
13-
# target = "container" # container | binary | library | wasm
12+
method = "ci-triggered"
13+
target = "binary" # binary CLI tool + library crate
1414

1515
[incident-response]
16-
# 1. Check .machine_readable/STATE.a2ml for current status
16+
# 1. Check .machine_readable/6a2/STATE.a2ml for current status
1717
# 2. Review recent commits and CI results
1818
# 3. Run `just validate` to check compliance
1919
# 4. Run `just security` to audit for vulnerabilities
20+
# 5. Verify K9 contract templates in .machine_readable/contractiles/k9/ are intact
2021

2122
[release-process]
22-
# 1. Update version in STATE.a2ml, META.a2ml, Justfile
23+
# 1. Update version in STATE.a2ml, META.a2ml, Cargo.toml, Justfile
2324
# 2. Run `just release-preflight` (validate + quality + security + maint-hard-pass)
2425
# 3. Optional local permission hardening: `just perms-snapshot && just perms-lock`
2526
# 4. Tag and push

.machine_readable/6a2/STATE.a2ml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,35 @@
55
(state
66
(metadata
77
(version "0.1.0")
8-
(last-updated "2026-03-20")
8+
(last-updated "2026-03-21")
99
(author "Jonathan D.A. Jewell"))
1010

1111
(project-context
1212
(name "k9iser")
13-
(description "Wrap configs into self-validating K9 contracts")
13+
(description "Analyse config files, infer constraints, generate K9 contracts, validate, and attest compliance")
1414
(status "scaffold")
1515
(priority "—")
1616
(ecosystem "-iser family (https://github.com/hyperpolymath/iseriser)"))
1717

1818
(current-position
1919
(phase "initial-scaffold")
20-
(completion-percentage 5)
21-
(milestone "Architecture defined, CLI scaffolded, RSR template complete"))
20+
(completion-percentage 8)
21+
(milestone "Architecture defined, CLI scaffolded, Idris2 ABI bespoke types written, Zig FFI bespoke stubs written, documentation complete"))
2222

2323
(route-to-mvp
24-
(step 1 "Replace codegen stubs with target-language-specific generation")
25-
(step 2 "Implement Idris2 ABI proofs for core invariants")
26-
(step 3 "Build Zig FFI bridge")
27-
(step 4 "Integration tests with real-world examples")
28-
(step 5 "Documentation and examples"))
24+
(step 1 "Implement multi-format config parser (TOML, YAML, JSON, Nickel) in bridges/")
25+
(step 2 "Build constraint inference engine in core/ — must, trust, dust, intend")
26+
(step 3 "Implement K9 contract codegen — emit .k9.ncl files from inferred constraints")
27+
(step 4 "Build validation engine — check configs against K9 contracts")
28+
(step 5 "Implement cryptographic attestation for validation results")
29+
(step 6 "Write Idris2 ABI proofs for constraint completeness and soundness")
30+
(step 7 "Build Zig FFI bridge for validation engine hot path")
31+
(step 8 "Integration tests with real-world config examples"))
2932

3033
(blockers-and-issues
3134
(none "Project is in scaffold phase — no blockers yet"))
3235

3336
(critical-next-actions
34-
(action "Implement codegen for primary use case")
35-
(action "Write first working example end-to-end")))
37+
(action "Implement TOML config parser and structural analysis in bridges/")
38+
(action "Define the unified config AST that all format parsers produce")
39+
(action "Build first must-rule inference from observed config patterns")))

0 commit comments

Comments
 (0)