BitGrid-Rust is a Rust from C systems-programming project. It reimplements the core ideas from a C-based Hitori puzzle assignment as a Rust command-line engine, while preserving the original project's low-level profile: compact board representation, row-major storage, bit-packed cell state, deterministic puzzle logic, graph validation, recursive search, CLI tooling, tests, and documentation.
The project intentionally evolves through three maturity levels:
School Assignment Baseline
-> MVP Standalone Rust CLI
-> MVP+ Systems-Style Portfolio Project
The project is not primarily a web app, UI product, or generic puzzle game. Its purpose is to demonstrate systems-style engineering and an AI-native builder workflow.
The central workflow claim is:
Codex is more than a coding agent. With the right workflow, context, and feedback loops, Codex can act as a tutor, implementer, reviewer, debugger, and documentation partner.
The central build loop is:
learn concept -> apply concept -> review implementation -> document lesson
Core framing:
This project intentionally preserves the same core profile across all maturity levels. The project grows in architecture, correctness, testing, tooling, and documentation, but it does not change identity: it remains a compact systems-style Hitori solver engine.
The project is inspired by a Computer Organization / C-programming course assignment based on Hitori puzzles.
The original assignment focused on low-level programming concepts:
- transferring a heap-allocated 2D board into a compact row-major 1D array
- storing puzzle cell values in individual bytes
- using bit masks to encode additional state inside each cell
- implementing blackout and circle deductions
- implementing sandwich and doublet deductions
- optionally implementing connectivity-aware gate deductions
- checking heap memory cleanup with Valgrind
BitGrid-Rust keeps the same core problem and systems flavor, but reimplements the project as a modern Rust CLI engine with stronger modularity, tests, validation, and portfolio-ready documentation.
The school assignment is the seed. The Rust project is the independent expansion.
BitGrid-Rust should be understood as a Rust from C project, not just a standalone Rust exercise.
That means the project should explicitly translate C systems concepts into Rust systems concepts:
| C concept | Rust counterpart |
|---|---|
typedef unsigned char Cell |
struct Cell(u8) newtype |
Cell *solution row-major array |
Vec<Cell> owned by Board |
| manual offset calculation | explicit row-major indexing helper |
bit masks such as 0x80, 0x40, 0x1F |
Rust constants and methods on Cell |
| manual allocation/free | ownership, Vec, and Drop behavior |
error codes / error() helper |
Result<T, BitGridError> |
| recursive C functions | Rust methods with controlled mutation |
| Valgrind leak checking | ownership, tests, Clippy, optional Miri |
| ad hoc function organization | modules, traits/enums, testable APIs |
The Rust version should not hide the original systems-programming concerns. Instead, it should make the translation visible through code, docs, tests, and phase closeouts.
The project has four main goals:
- Preserve the core profile of the original systems-style assignment.
- Progressively expand the project from school assignment to MVP to MVP+.
- Demonstrate Rust systems-programming concepts through a concrete C-to-Rust transfer.
- Demonstrate an AI-native phase-based workflow where Codex is used in multiple roles.
The technical goal is to build a Rust Hitori engine that shows:
- compact board representation
- row-major storage
- bit-packed cell state
- deterministic deduction rules
- graph-based validation
- recursive search
- CLI usability
- testing and benchmarking discipline
The workflow goal is to show that effective AI-native building depends on:
- clear project context
- explicit phase boundaries
- tutor-before-build sequencing
- proposal-before-implementation discipline
- tests and feedback loops
- human review
- closeout documentation
- progressive refinement rather than one-shot generation
Codex should be intentionally used in multiple shapes, not only as a coding agent.
Codex explains Rust concepts needed for the next implementation phase.
Examples:
- ownership and borrowing
Vec<Cell>as owned board storage- newtype pattern with
Cell(u8) Result<T, E>error handling- module organization
- traits vs enums for rule engines
- recursion and cloning tradeoffs
- testing and Clippy discipline
Tutor output should end with a checklist of what the human developer should understand before implementation begins.
Codex implements only the approved build phase.
Implementation should be bounded by:
- phase goal
- files allowed to change
- tests required
- out-of-scope items
- acceptance criteria
Codex should not build future phases early.
Codex reviews completed phase work for:
- correctness
- Rust API design
- unnecessary complexity
- hidden panics
- missing tests
- docs drift
- C-to-Rust translation quality
Codex helps interpret:
- compiler errors
- borrow checker errors
- failed tests
- parser edge cases
- recursion bugs
- CLI behavior mismatches
Debugging should preserve learning value. Codex should explain why the bug happened, not only patch it.
Codex helps update:
README.mdAGENTS.mdAI_native_builder_journal.mddocs/architecture.mddocs/phase_catalog.mddocs/c_to_rust_translation.md- phase closeout notes
Documentation should capture what changed, why it changed, and what was learned.
Each paired phase should follow this loop:
learn concept -> apply concept -> review implementation -> document lesson
Codex acts as tutor. The goal is to understand the Rust concepts needed for the next build phase.
Expected output:
- concept explanation
- C-to-Rust mapping
- pitfalls to watch for
- small examples only if useful
- readiness checklist
Codex acts as implementer. The goal is to implement the bounded phase.
Expected output before coding:
- short plan
- files likely to change
- tests likely to add
- risks
- explicit out-of-scope list
Codex acts as reviewer and debugger. The goal is to inspect the implementation and tests before moving on.
Expected output:
- what looks correct
- what needs improvement
- whether the Rust design matches the C-to-Rust translation goal
- tests run
- failures or concerns
Codex acts as documentation partner. The goal is to make the workflow visible.
Expected output:
- phase closeout note
- concepts learned
- C concept translated
- implementation summary
- tests added
- known follow-ups
BitGrid-Rust is not intended to become:
- a web application
- a large visual puzzle game
- a generic AI chatbot
- a database-backed product app
- a mobile app
- a frontend-heavy portfolio project
- a puzzle collection with many unrelated games
- a one-shot AI-generated code dump
The project should remain centered on systems-style Rust engineering and AI-native workflow evidence.
BitGrid-Rust should be understood as a maturity ladder:
Level 0: School Assignment Baseline
Level 1: MVP Standalone Rust CLI
Level 2: MVP+ Systems-Style Portfolio Project
Each level preserves the same core project identity while increasing architectural seriousness, correctness, tests, tooling, documentation, and workflow evidence.
The baseline represents the original assignment-level project.
At this level, the project demonstrates that the developer can implement the core mechanics of a Hitori solver in a low-level programming context.
Expected capabilities:
- load a Hitori puzzle file
- represent board cells compactly
- store board data in row-major order
- use bit masks to distinguish number, blacked-out state, and circled state
- implement blackout and circle propagation
- implement sandwich deductions
- implement doublet deductions
- write a solution file
- run basic manual tests against provided puzzles
Portfolio interpretation:
Level 0 proves exposure to the core problem and low-level concepts. It does not yet prove independent productization, architectural design, or full testing discipline.
This level is valuable as coursework, but it is not yet a standalone portfolio project.
The MVP turns the school-style assignment into a standalone Rust command-line tool.
The MVP should be small but complete. A reviewer should be able to clone the repository, run the tool, solve sample puzzles, validate outputs, and run tests.
Required MVP capabilities:
- Rust project skeleton using Cargo
Cellrepresentation backed by compactu8storageBoardrepresentation backed by row-majorVec<Cell>- parser for puzzle files
- writer for solution files
- blackout and circle propagation
- sandwich deduction
- doublet deduction
- repeated deterministic solving loop
- board validator
- CLI command for solving puzzles
- CLI command for validating solutions
- unit tests for cell bit operations
- unit tests for board indexing
- parser and writer tests
- integration tests for sample puzzles
- README with setup, run commands, and current project status
- AI-native builder journal entries for each paired phase
cargo run -- solve puzzles/practice.puz
cargo run -- validate solutions/practice.sol
cargo testThe MVP is complete when:
- the project builds with
cargo build - tests pass with
cargo test - at least one provided puzzle can be solved or partially solved deterministically
- validator catches invalid duplicate, adjacency, and connectivity cases
- README accurately describes the current implementation
- project structure is clean enough for future phases
- the journal shows tutor/build/review/document loops for MVP phases
The MVP demonstrates that the original assignment has been converted into a real Rust CLI project with clean structure, tests, and basic user-facing commands.
It is no longer only a class exercise, but it is still not the final portfolio version.
The MVP+ expands the Rust CLI tool into a stronger systems-style engine.
MVP+ should demonstrate deeper architecture, stronger correctness guarantees, and clearer evidence of engineering discipline.
Required MVP+ capabilities:
- modular rule engine
- gate/connectivity-aware deductions
- full board validation independent from solving
- recursive backtracking fallback
- contradiction detection
- solver trace / explanation mode
- benchmark command
- structured solver statistics
- improved error handling
- larger puzzle corpus
- stronger integration tests
- documentation of architecture and design tradeoffs
- C-to-Rust comparison notes
- AI-native builder journal with paired phase closeouts
cargo run -- solve puzzles/practice.puz
cargo run -- solve puzzles/practice.puz --logic-only
cargo run -- solve puzzles/practice.puz --search
cargo run -- solve puzzles/practice.puz --explain
cargo run -- validate solutions/practice.sol
cargo run -- bench puzzles/
cargo test
cargo clippyThe MVP+ is complete when:
- solver handles puzzles that require more than the basic assignment rules
- search fallback works when deterministic deductions stall
- validator is independent from solver logic
- explanation mode produces deterministic, inspectable traces
- benchmark mode reports solve time, deduction count, guesses, and recursion depth
- documentation explains why Rust is appropriate for this project
- C-to-Rust comparison notes are present
- AI-native builder journal shows paired tutor/build/review/document workflow evidence
The MVP+ demonstrates a portfolio-level systems-style Rust project.
It shows compact representation, algorithmic reasoning, graph traversal, recursive search, CLI design, testing discipline, benchmarking, C-to-Rust transfer, and AI-native workflow control.
A Hitori puzzle presents a grid of numbers. The solver must determine which cells should be blacked out so that:
- No row contains more than one visible occurrence of the same number.
- No column contains more than one visible occurrence of the same number.
- Blacked-out cells are not horizontally or vertically adjacent.
- All non-blacked-out cells remain connected horizontally or vertically.
BitGrid-Rust should preserve these rules as the core domain model.
BitGrid-Rust should preserve the compact representation style of the original C assignment while using Rust's ownership and type system.
Expected representation:
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct Cell(u8);
pub struct Board {
rows: usize,
cols: usize,
cells: Vec<Cell>,
}Expected bit layout:
bit 7 bit 6 bit 5 bits 4-0
BLACK CIRCLE RESERVED NUMBER
Expected masks:
const BLACK_MASK: u8 = 0x80;
const CIRCLE_MASK: u8 = 0x40;
const NUMBER_MASK: u8 = 0x1F;The Rust version should not hide the low-level representation behind unnecessary abstractions. The project should still make row-major indexing, bit masks, compact storage, and state transitions visible in the code and docs.
Planned module structure:
src/
├── main.rs
├── cell.rs
├── board.rs
├── parser.rs
├── writer.rs
├── solver.rs
├── rules.rs
├── validate.rs
├── search.rs
├── trace.rs
├── bench.rs
└── error.rs
Expected responsibilities:
cell.rs: compact cell representation and bit operationsboard.rs: row-major board storage and safe access APIsparser.rs: puzzle file parsingwriter.rs: solution outputrules.rs: deduction rulessolver.rs: solver loop and orchestrationvalidate.rs: Hitori correctness checkssearch.rs: recursive backtracking fallbacktrace.rs: explanation loggingbench.rs: benchmark runnererror.rs: shared error types
The architecture should keep puzzle I/O, board representation, solving, validation, search, tracing, and CLI code separated.
A Cell stores both the puzzle number and solver state in a single byte.
Cell state:
- number: lower 5 bits
- blacked-out flag: high bit
- circled flag: second-highest bit
- reserved bit: available for future internal use
Expected behavior:
Cell::number()returns only the lower 5-bit number.Cell::is_black()checks the black flag.Cell::is_circled()checks the circle flag.Cell::with_black()or equivalent marks a cell as black.Cell::with_circle()or equivalent marks a cell as circled.- contradictory state transitions should be rejected at the board or solver layer.
A Board owns a row-major vector of cells.
Index calculation:
index = row * cols + colThe board should expose safe APIs for accessing and mutating cells. Internal helpers may assume validated indexes when appropriate, but public-facing APIs should avoid panics where recoverable errors are better.
Expected board behavior:
- create board from dimensions and cells
- reject invalid dimensions or mismatched cell counts
- retrieve cells by row and column
- mutate cells by row and column
- iterate rows and columns where useful
- clone board state for search fallback
The CLI should remain simple and engine-focused. It should not become a large interactive application.
bitgrid solve <puzzle-file>
bitgrid validate <solution-file>bitgrid solve <puzzle-file> --logic-only
bitgrid solve <puzzle-file> --search
bitgrid solve <puzzle-file> --explain
bitgrid validate <solution-file>
bitgrid bench <puzzle-directory>
bitgrid inspect <puzzle-file>CLI output should be readable, deterministic, and useful for testing.
Example solve output:
Solved: yes
Size: 8x8
Mode: search
Deductions: 93
Guesses: 2
Max recursion depth: 1
Validation: passed
The solver should support deterministic rule propagation first.
Required deterministic rules:
- blackout propagation
- circle propagation
- sandwich deduction
- doublet deduction
MVP+ rules:
- gate/connectivity-aware deduction
- contradiction detection
- recursive backtracking fallback
The solver should support three result states:
- solved
- unsolved but valid
- contradiction / invalid
The solver should distinguish between:
- logic-only solving
- search-assisted solving
- validation of a final board state
The validator must be independent from the solver.
It should verify:
- no duplicate visible number in any row
- no duplicate visible number in any column
- no adjacent black cells
- all visible cells are connected
The connectivity check should use graph traversal over the grid.
The validator should be usable both:
- internally by the solver
- externally through the CLI
Testing should grow with each maturity level.
- manual tests using provided puzzles
- unit tests for
Cell - unit tests for
Board - parser tests
- writer tests
- validator tests
- integration test for solving a sample puzzle
- rule-specific tests
- search tests
- contradiction tests
- connectivity tests
- CLI tests if practical
- benchmark smoke test
- regression puzzle corpus
Default verification commands:
cargo test
cargo clippy
cargo fmt --checkOptional later verification:
cargo bench
cargo miri testRequired docs:
README.mdAGENTS.mdAI_native_builder_journal.mddocs/project_specs.mddocs/architecture.mddocs/phase_catalog.mddocs/c_to_rust_translation.md
Optional later docs:
docs/c_vs_rust_notes.mddocs/solver_rules.mddocs/benchmark_results.mddocs/puzzle_format.mddocs/quality_hardening_plan.md
The README should always reflect the current project state.
The AI-native builder journal should record phase closeouts and make the workflow visible.
Instead of a normal phase catalog, BitGrid-Rust uses paired phases:
R0-Tutor -> R0-Build
R1-Tutor -> R1-Build
R2-Tutor -> R2-Build
...
Each tutor phase teaches the Rust concept needed for the next build phase. Each build phase applies that concept to the project.
Each phase pair should close with review and documentation:
Tutor -> Build -> Review -> Document
Goal:
- capture the original C assignment's purpose, constraints, and low-level concepts
- identify what should be preserved in Rust
Outputs:
docs/original_assignment_summary.mddocs/c_to_rust_translation.mdinitial version- journal entry explaining why the Rust project exists
Goal:
- map the original C concepts to Rust concepts
- define which concepts are essential to the project's identity
Outputs:
- C-to-Rust concept map
- initial MVP boundary
- initial MVP+ boundary
Tutor goal:
- explain the Rust project model
- explain Cargo, crates, modules,
src/main.rs,src/lib.rs, and tests - explain ownership at a high level using the board engine as the example
C concept translated:
- C files, headers, Makefile, and manual build commands become Cargo project structure and Rust modules.
Readiness checklist:
- understand what Cargo manages
- understand where library code and CLI code should live
- understand why the board should own its cell storage
Build goal:
- create the Rust project skeleton
- separate library code from CLI entrypoint
- add initial README and test command
Expected outputs:
Cargo.tomlsrc/lib.rssrc/main.rs- basic
README.md - first passing
cargo test
Out of scope:
- board implementation
- parser
- solver rules
- CLI commands beyond a placeholder
Tutor goal:
- explain the
Cell(u8)newtype pattern - explain bit masks in Rust
- explain
Copy,Clone,Debug, andPartialEq - explain safe method APIs around compact representation
C concept translated:
typedef unsigned char Cellplus C macros becomes a RustCell(u8)type with methods.
Readiness checklist:
- understand why
Cell(u8)preserves compact storage - understand how bit masks are expressed as constants
- understand why methods are safer than exposing raw bit operations everywhere
Build goal:
- implement compact
Cell - implement row-major
Board - add safe indexing and mutation APIs
- add tests for bit operations and indexing
Expected outputs:
src/cell.rssrc/board.rs- tests for masks, state flags, number extraction, and row-major indexing
Out of scope:
- file parsing
- solving rules
- CLI solve command
Tutor goal:
- explain Rust error handling with
Result<T, E> - explain custom error enums
- explain file reading and parser boundaries
C concept translated:
- C helper errors and manual failure exits become structured Rust errors.
Readiness checklist:
- understand when to return
Result - understand why parser code should not directly exit the program
- understand how CLI can display parser errors later
Build goal:
- parse puzzle files into
Board - write board/solution output
- reject invalid dimensions, values, and malformed input
- add parser and writer tests
Expected outputs:
src/parser.rssrc/writer.rssrc/error.rs- sample puzzle files
- parser/writer tests
Out of scope:
- solver logic
- full CLI solve behavior
Tutor goal:
- explain mutable borrowing for board updates
- explain avoiding conflicting borrows during row/column scans
- explain recursion risks in Rust mutation-heavy code
C concept translated:
- direct mutation through pointers becomes controlled mutation through
&mut Board.
Readiness checklist:
- understand
&Boardvs&mut Board - understand how to collect affected cells before mutating when needed
- understand how to avoid borrow checker conflicts in propagation logic
Build goal:
- implement blackout operation
- implement circle operation
- implement contradiction detection
- implement propagation between blackout and circle
- add tests for mutual propagation and termination
Expected outputs:
src/solver.rsorsrc/state.rs- tests for blackout, circle, duplicate propagation, neighbor propagation, and contradictions
Out of scope:
- sandwich/doublet rules
- CLI solve command beyond internal tests
Tutor goal:
- explain options for organizing solver rules
- compare enum-based rules vs trait-based rules
- explain why a simple enum/function approach may be better early
C concept translated:
- separate C helper functions become testable Rust rule functions with structured results.
Readiness checklist:
- understand how each rule reports changed/no-change/contradiction
- understand why rules should not own CLI behavior
- understand how a repeated rule loop works
Build goal:
- implement sandwich deduction
- implement doublet deduction
- implement repeated deterministic solve loop
- add rule-specific tests
Expected outputs:
src/rules.rs- updates to
src/solver.rs - tests for sandwich, doublet, and repeated solving
Out of scope:
- gate deduction
- backtracking search
- explanation mode
Tutor goal:
- explain BFS/DFS over a row-major grid
- explain
VecDeque - explain visited tracking with
Vec<bool>or bitset-like storage
C concept translated:
- manual queue/visited arrays become Rust-owned collections with explicit traversal logic.
Readiness checklist:
- understand how grid neighbors are generated
- understand why validator must be independent from solver
- understand how connectivity relates to Hitori correctness
Build goal:
- validate duplicate row values
- validate duplicate column values
- validate adjacent black cells
- validate connected visible cells
- add validation tests
Expected outputs:
src/validate.rs- connectivity tests
- invalid board fixtures
Out of scope:
- gate deduction
- backtracking
- benchmark command
Tutor goal:
- explain CLI argument handling options
- explain how CLI should call library code without owning solver logic
- explain deterministic command output for tests
C concept translated:
- assignment-style executable becomes a structured CLI wrapper over a library engine.
Readiness checklist:
- understand why
main.rsshould stay thin - understand how command output should support review and testing
Build goal:
- add
solvecommand - add
validatecommand - update README with current setup and usage
- complete MVP closeout
Expected outputs:
src/main.rsCLI behavior- README current-state update
- MVP closeout in journal
Out of scope:
- advanced search
- explanation trace
- benchmarking
Tutor goal:
- explain gate deductions conceptually
- explain temporary board cloning vs rollback
- explain how to test simulation without corrupting real board state
C concept translated:
- extra-credit C gate deduction becomes a Rust connectivity-aware rule using safe temporary state.
Build goal:
- implement connectivity-aware gate deduction
- integrate it into the deterministic rule loop
- add focused tests
Expected outputs:
- gate rule implementation
- tests for temporary simulation and board preservation
Tutor goal:
- explain recursive search in Rust
- explain board cloning vs undo logs
- explain how to return solved/failed/contradiction states
C concept translated:
- recursive C search with manual state management becomes Rust search over cloned or explicitly restored board states.
Build goal:
- add search fallback when logic stalls
- track guesses and recursion depth
- integrate validator/contradiction checks
- add search tests
Expected outputs:
src/search.rs- solver integration
- tests for puzzles requiring search
Tutor goal:
- explain structured logging without mixing logging into business logic
- explain trace events and deterministic output
C concept translated:
- print-debugging or assignment output becomes structured solver trace events.
Build goal:
- add trace event type
- log deductions and search decisions
- add
--explainmode - add deterministic trace tests where practical
Expected outputs:
src/trace.rs- CLI explain mode
- trace documentation
Tutor goal:
- explain timing, benchmark limitations, and stable output
- explain what metrics matter for a solver engine
C concept translated:
- systems performance awareness becomes explicit benchmark instrumentation.
Build goal:
- add benchmark command over puzzle directory
- report solve time, deductions, guesses, recursion depth, and validation result
- add benchmark smoke test if practical
Expected outputs:
src/bench.rsbenchmarks/output examples- README benchmark section
Tutor goal:
- explain
cargo fmt, Clippy, optional Miri, and regression tests - explain how Rust's safety model changes the hardening process compared with C
C concept translated:
- Valgrind/ASan-focused C hardening becomes Rust testing, Clippy, formatting, optional Miri, and careful panic/error review.
Build goal:
- add broader puzzle fixtures
- add regression tests
- run
cargo test,cargo clippy, andcargo fmt --check - document known limitations
Expected outputs:
- expanded tests
TESTING.mdor testing section- hardening closeout
Tutor goal:
- compare what C demonstrates vs what Rust demonstrates
- explain ownership, safety, abstraction, and performance tradeoffs
- help shape portfolio language honestly
C concept translated:
- direct low-level C control becomes modern systems programming with ownership and safe abstractions.
Build goal:
- finalize README
- finalize architecture docs
- finalize C-to-Rust comparison notes
- finalize AI-native builder journal
- prepare portfolio-ready closeout
Expected outputs:
README.mddocs/architecture.mddocs/c_to_rust_translation.mddocs/c_vs_rust_notes.mdAI_native_builder_journal.md- MVP+ closeout
Tutor goal:
- explain the senior-review findings that remain after R12
- explain why state-aware solution output matters for a Hitori CLI
- explain the distinction between deterministic solving, search-assisted solving, stalled states, exhausted search, and contradiction
- compare the Rust gate deduction with the hardened C reference rule
- prepare a small-subphase hardening plan instead of one broad rewrite
C concept translated:
- completed C project hardening becomes a Rust post-review hardening phase with explicit CLI behavior, stateful solution files, solver statuses, regression tests, and documentation closeout.
Readiness checklist:
- understand why
solvemust display black/circle state to be inspectable - understand why
validate <solution-file>should parse real solution state - understand why CLI search modes should expose the implemented recursive search
- understand why gate deduction must not over-deduce from undecided connectivity
- understand why R13 should be implemented as R13A through R13E, not as one large patch
Build goal:
- harden the reviewed R12 project into a project-ready portfolio artifact
- preserve the compact C-to-Rust systems profile
- keep each hardening subphase small, testable, documented, and reviewable
Expected subphases:
- R13A - state-aware solution output and validation
- R13B - CLI
--searchand--logic-onlysolve modes - R13C - gate deduction hardening against the completed C reference
- R13D - clearer solver result statuses
- R13E - final docs refresh and R13 closeout
Expected outputs:
- state-aware solution format and fixtures
- CLI tests for search-assisted and logic-only solve modes
- gate deduction positive and negative regression tests
- solver status tests for solved, stalled, exhausted, contradiction, and invalid states
- refreshed README, architecture, testing, and C-to-Rust translation docs
- R13 closeout in
AI_native_builder_journal.mdanddocs/phase_closeouts/
Out of scope:
- web UI or GUI
- puzzle generation
- unrelated puzzle types
- broad rewrites of
Cell(u8)or row-majorBoard - Criterion benchmarks or performance optimization unless separately approved
Detailed plan:
docs/quality_hardening_plan.md
A phase is complete only when:
- the tutor concept or build objective is complete
- the intended behavior works locally if code was changed
- tests are added or updated when behavior changed
- documentation is updated if behavior, setup, or design changed
- known limitations are recorded
- the repository remains clean and reviewable
- the AI-native builder journal receives a closeout note
Each phase should leave the repository in a working state.
Each paired phase should end with a journal entry using this structure:
## Phase R1 — Cell and Board
### Tutor Objective
Understand Rust newtypes, `u8` bit masks, and safe APIs for compact cell state.
### Build Objective
Implement `Cell` and `Board` with row-major storage and unit tests.
### Rust Concepts Learned
- `Cell(u8)` newtype
- `Copy` and `Clone`
- constants for bit masks
- safe indexing methods
### C Concept Translated
C `typedef unsigned char Cell` and `Cell*` row-major storage became Rust `Cell(u8)` and `Vec<Cell>` owned by `Board`.
### Implementation Summary
Added compact cell representation, row-major board storage, and tests.
### Review Notes
Checked bit masking behavior, indexing math, and public API boundaries.
### Tests Run
- `cargo test`
- `cargo fmt --check`
### Known Follow-Ups
Parser and writer remain out of scope until R2.The project should be built through a phase-based AI-native workflow.
Codex should not be asked to build the whole project in one pass.
For each tutor phase, Codex should provide:
- concept explanation
- C-to-Rust mapping
- common pitfalls
- small examples only when useful
- readiness checklist
For each build phase, Codex should first provide:
- phase summary
- implementation plan
- files likely to change
- tests likely to change
- risks or scope questions
- explicit out-of-scope list
Implementation should begin only after the human owner approves the phase plan.
After implementation, each phase should end with:
- tests run
- files changed
- what was built
- what was learned
- known follow-ups
- phase closeout note
The human developer remains responsible for:
- project direction
- architecture approval
- scope control
- reviewing generated code
- deciding when a phase is complete
- deciding what belongs in the public portfolio narrative
BitGrid-Rust should be positioned as:
A Rust-from-C systems-style constraint-solving engine that evolves from a school-style Hitori assignment into a tested, documented, CLI-based MVP and then into an MVP+ project with graph validation, recursive search, solver tracing, benchmarking, and phase-based AI-native development evidence.
The project should demonstrate:
- Rust systems programming fundamentals
- C-to-Rust concept transfer
- compact data representation
- algorithmic problem solving
- graph traversal
- recursive search
- CLI tool design
- testing discipline
- AI-native workflow control
The intended final narrative is not simply:
I implemented Hitori in Rust.
The stronger narrative is:
I used a phase-based AI-native workflow to transfer a C systems-programming assignment into Rust, using Codex as tutor, implementer, reviewer, debugger, and documentation partner. The project demonstrates that effective AI-native building depends on workflow, context, and feedback loops, not just code generation.
Future expansion should preserve the core profile. Acceptable future directions include:
- comparing C and Rust implementations
- adding stronger benchmark reports
- adding more puzzle files
- adding optional JSON trace output
- adding a second puzzle type only if the Hitori engine is already stable
- documenting Rust-specific design tradeoffs
Future expansion should avoid:
- converting the project into a web app too early
- adding UI complexity that distracts from systems design
- adding AI-generated puzzle reasoning as a replacement for deterministic rules
- broadening into many unrelated puzzle types before the Hitori engine is strong
BitGrid-Rust succeeds when it clearly shows the full progression:
School assignment seed
-> standalone Rust CLI MVP
-> systems-style MVP+ portfolio project
It also succeeds when the build trail clearly shows the AI-native learning and implementation loop:
learn concept
-> apply concept
-> review implementation
-> document lesson
The final project should make it obvious that the same core profile was preserved throughout:
- compact representation
- row-major board layout
- bit-packed cell state
- deterministic solving
- graph validation
- recursive search
- CLI tooling
- tests
- documentation
- C-to-Rust comparison
- AI-native paired phase workflow