Skip to content

Commit 103b266

Browse files
committed
docs: add trace-id eventness lanes and bump to 0.2.7
1 parent 669958d commit 103b266

10 files changed

Lines changed: 308 additions & 4 deletions

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "recur"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
edition = "2021"
55
authors = ["User Level Up Contributors"]
66
description = "Recursive hierarchical search tool for modern codebases - Honoring Dennis Ritchie's 1968 thesis (58 years of recursive hierarchies)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>recur</h1>
3-
<div class="version">v0.2.6</div>
3+
<div class="version">v0.2.7</div>
44
<p>
55
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
66
<a href="https://www.rust-lang.org/"><img alt="Rust 1.70+" src="https://img.shields.io/badge/rust-1.70%2B-blue.svg"></a>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a.0.2.6
1+
a.0.2.7

docs/main.improvement.8.todo.future-plan.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ Improvement 8 is planned for future work.
66

77
Reference:
88
- `README.CORE.IMPROVEMENT8.md`
9+
10+
Active lane (2026-03-03):
11+
- `docs/main.improvement.8.trace-id.todo.current.md`
12+
13+
Current focus:
14+
- Build-now `trace-id` MVP (command surface + built-in heuristics + tests)
15+
16+
Deferred from Improvement 8 to Improvement 9:
17+
- `docs/main.improvement.9.trace-id.todo.future-plan.md`
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Improvement 8: trace-id MVP
2+
3+
Status: `todo.current` (active)
4+
Date: 2026-03-03
5+
6+
## Goal
7+
8+
Implement a build-now `trace-id` MVP that can trace hierarchical identifier flow using built-in heuristics and existing recur infrastructure.
9+
10+
## In Scope (Now)
11+
12+
1. Add `recur trace-id` CLI command surface.
13+
2. Implement built-in role classification for identifier matches:
14+
- `define`
15+
- `produce`
16+
- `consume`
17+
- `trigger`
18+
3. Support scope/ext/stdin filtering consistent with existing content-search commands.
19+
4. Add JSON output and human-readable terminal output for traced identifier flows.
20+
5. Reuse traversal guardrails (`--depth-guard`, `--force`) where applicable.
21+
6. Add unit and Julia integration tests for MVP behavior.
22+
23+
## Out of Scope (Deferred)
24+
25+
Deferred to Improvement 9:
26+
27+
1. Project-custom heuristic config (`.recur/trace-id.toml`).
28+
2. `merge --edge-type` semantic lane stitching.
29+
3. Full multi-lane composition across call/route/config graphs.
30+
31+
## Working Files
32+
33+
- `src/main.rs`
34+
- `src/main_command_trace_id_impl.rs` (new)
35+
- `src/search.rs` (trace-id support)
36+
- `src/output.rs` (trace-id formatting)
37+
- `julia-tests/main.command.trace-id.test.jl` (new)
38+
- `julia-tests/runtests.trace-id.jl` (new)
39+
- `docs/main.command.trace-id.readme.md` (new)
40+
41+
## Success Criteria
42+
43+
1. `recur trace-id --help` documents command usage and examples.
44+
2. `recur trace-id "<id>" --scope "**"` produces stable JSON and terminal output.
45+
3. MVP tests pass for define/produce/consume/trigger detection.
46+
4. No regressions in existing `trace`, `id`, and `merge` command behavior.
47+
48+
## Related
49+
50+
- `docs/main.improvement.8.trace-id.todo.current.reference.md`
51+
- `docs/main.improvement.8.trace-id.todo.trigger.event.md`
52+
- `docs/main.improvement.9.trace-id.todo.future-plan.md`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Reference: Improvement 8 trace-id MVP
2+
3+
## Primary Inputs
4+
5+
- `ulu_docs/recur-agent.static-analysis.md`
6+
- `ulu_docs/recur-agent.trace-id.proposal.md`
7+
8+
## Existing Implementation References
9+
10+
- `src/main_command_id_impl.rs` - identifier pattern scanning entrypoint
11+
- `src/main_command_trace_impl.rs` - command shape, scope/ext/stdin flow, guardrails
12+
- `src/main_command_trace_stats_impl.rs` - structured metrics pipeline patterns
13+
- `src/search.rs` - reusable search primitives and trace graph data structures
14+
- `src/output.rs` - JSON and terminal formatter patterns
15+
- `src/main_command_merge_impl.rs` - current merge behavior and JSON input contracts
16+
- `julia-tests/runtests.id.jl` - identifier command test style
17+
- `julia-tests/runtests.trace.jl` - trace command test style
18+
- `julia-tests/runtests.trace-stats.jl` - command contract and metrics assertions
19+
20+
## How to Study
21+
22+
```bash
23+
cat src/main_command_id_impl.rs
24+
cat src/main_command_trace_impl.rs
25+
cat src/main_command_trace_stats_impl.rs
26+
cat src/search.rs
27+
cat src/output.rs
28+
cat julia-tests/runtests.id.jl
29+
cat julia-tests/runtests.trace.jl
30+
cat julia-tests/runtests.trace-stats.jl
31+
```
32+
33+
## Recommended Approach
34+
35+
1. Start with a standalone command module `main_command_trace_id_impl.rs` that mirrors `id` and `trace` command ergonomics.
36+
2. Implement MVP heuristics in code first (no config file yet).
37+
3. Emit an output shape that can later compose with merge (include node role metadata), but do not add `merge --edge-type` in this phase.
38+
4. Keep the MVP narrow and test-backed; defer cross-lane semantic composition to Improvement 9.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Trigger Events: Improvement 8 trace-id MVP
2+
3+
## On Start
4+
5+
```bash
6+
recur files "**.current" -d docs/
7+
recur tree "main.improvement.8" -d docs/
8+
cat docs/main.improvement.8.trace-id.todo.current.md
9+
cat docs/main.improvement.8.trace-id.todo.current.reference.md
10+
```
11+
12+
## During Work
13+
14+
```bash
15+
# Command + search lanes
16+
recur find "TraceStats {" --scope "**" -d src/
17+
recur find "Id {" --scope "**" -d src/
18+
recur files "main_command_*_impl" -d src/ --sep _
19+
20+
# Verify target command lanes as they are added
21+
recur files "main_command_trace_id_*" -d src/ --sep _
22+
recur files "main.command.trace-id.**" -d docs/
23+
24+
# Tight implementation loop
25+
cargo test --bin recur
26+
```
27+
28+
## On Validate
29+
30+
```bash
31+
# Focused lane checks
32+
julia julia-tests/main.command.id.test.jl
33+
julia julia-tests/main.command.trace.test.jl
34+
julia julia-tests/main.command.trace-stats.test.jl
35+
36+
# New lane checks (after files are added)
37+
julia julia-tests/main.command.trace-id.test.jl
38+
```
39+
40+
## On Complete
41+
42+
```bash
43+
cargo test
44+
45+
# cleanup ephemerals
46+
rm docs/main.improvement.8.trace-id.todo.current.md
47+
rm docs/main.improvement.8.trace-id.todo.current.reference.md
48+
rm docs/main.improvement.8.trace-id.todo.trigger.event.md
49+
50+
# completion marker to add:
51+
# docs/main.improvement.8.trace-id.complete.md
52+
```

docs/main.improvement.9.todo.future-plan.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ Next TODO:
1919
1. Keep dot notation as the default canonical format for semantic IDs.
2020
2. Use `docs/main.semantic.names.txt` as the centralized `.todo.tracking` queue.
2121
3. Resolve queued IDs through file-layer commands (`recur files` / `recur tree`) before in-file analysis.
22+
23+
Deferred lane added:
24+
- `docs/main.improvement.9.trace-id.todo.future-plan.md`
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Improvement 9: trace-id Deferred Scope
2+
3+
Status: `todo.future-plan`
4+
Date: 2026-03-03
5+
6+
## Purpose
7+
8+
Track post-MVP `trace-id` work that is intentionally deferred while Improvement 8 delivers the build-now command.
9+
10+
## Deferred Items
11+
12+
1. Project-custom heuristic configuration:
13+
- `.recur/trace-id.toml`
14+
- load-order strategy (project-local, user-level, defaults)
15+
2. Merge semantic edge typing:
16+
- `merge --edge-type`
17+
- lane-aware joins for call/route/config composition
18+
3. Rich multi-lane composition workflow:
19+
- `trace` + `trace-id` + `flatten` merged into a single semantic graph view
20+
4. Additional performance and false-positive hardening across large codebases.
21+
22+
## Hand-off from Improvement 8
23+
24+
Prerequisite:
25+
- `docs/main.improvement.8.trace-id.complete.md` exists with MVP completion evidence.
26+
27+
Inputs from MVP:
28+
- command JSON schema shape
29+
- built-in heuristic behavior
30+
- test fixtures and known edge cases
31+
32+
## Related
33+
34+
- `docs/main.improvement.8.trace-id.todo.current.md`
35+
- `docs/main.improvement.8.todo.future-plan.md`
36+
- `docs/main.improvement.9.todo.future-plan.md`

julia-expert/references/recur-playbook.md

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ The same query-first workflow is portable to external projects (including Visual
1919

2020
**Key Principle:** Don't search manually or remember where things are. Use recur to discover what to work on, what to reference, and what's of interest.
2121

22+
## Search vs State (Use the Right Layer)
23+
24+
Recur solves two different problems. Pick the layer before you pick the command:
25+
26+
- Search and analysis (solve code and behavior issues): `find`, `id`, `callers`, `callees`, `trace`, `trace-stats`, `flatten`
27+
- State and workflow tracking (manage active work): `files`, `tree`, `stats`, `related`, `children`, `merge`, suffix-based eventness files
28+
29+
When debugging or proving safety, use search tools first. Use state tools to track and hand off work.
30+
31+
## Skim-Then-Explore Rule
32+
33+
Before deep work in an unfamiliar subsystem, spend 5 minutes finding existing guidance and then explore organically:
34+
35+
```bash
36+
# Find local guides/checklists first
37+
recur files "**agent**" -d docs/
38+
recur files "**readme**" -d docs/
39+
40+
# Then start real discovery
41+
recur files "**.current" -d docs/
42+
recur find "<symbol-or-text>" --scope "**" -d src/
43+
```
44+
2245
## stdin/stdout Piping (Composability!)
2346

2447
**Recur is a Unix-style composable tool** - all commands support `--stdin` to read file paths and output to stdout.
@@ -72,6 +95,8 @@ recur files "**.current" -d docs/ | ConvertFrom-Json | ForEach-Object { Get-Item
7295

7396
**PowerShell tip:** `recur files` already outputs a JSON array by default in normal pipelines. Use `ConvertFrom-Json` before object operations; only add `--json` when you need to force machine format explicitly.
7497

98+
**Pipeline tip:** In non-terminal pipelines, recur output is machine-oriented. When scripting, assume JSON and parse it explicitly (`ConvertFrom-Json` or `jq`) unless you intentionally force text.
99+
75100
## Core Recur Commands
76101

77102
### File Discovery
@@ -98,6 +123,32 @@ recur find "StdinCapable" --scope "main_command_**" -d src/ --sep _
98123
recur find "pattern" --scope "**" -C 2
99124
```
100125

126+
### Static Analysis (Bug-Finding Commands)
127+
```bash
128+
# Hierarchical identifiers inside file content (dot-path strings)
129+
recur id "ulu.topic.dot.**" --ext .cs
130+
131+
# Who calls this? (impact before rename/remove)
132+
recur callers "FunctionName" --scope "**" --ext .rs --count
133+
134+
# What does this call? (dependency inspection)
135+
recur callees "FunctionName" --scope "**" --ext .rs
136+
137+
# Multi-level call graph (use --pick when names are ambiguous)
138+
recur trace "FunctionName" --scope "**" --ext .rs --depth 2 --direction both
139+
recur trace "FunctionName" --scope "**" --ext .rs --pick 1
140+
141+
# Complexity hotspots and circular-risk lanes
142+
recur trace-stats --scope "**" --ext .rs --sort-by risk --top 10
143+
recur trace-stats --scope "**" --ext .rs --filter circular-only
144+
```
145+
146+
**Static analysis guardrails:**
147+
- `callers`/`callees`/`trace` are text-based analysis, not full AST/type resolution.
148+
- If `trace` reports multiple matches, use `--pick <N>` instead of rewriting the query.
149+
- `trace` and `trace-stats` have traversal guardrails (`--depth-guard`, `--force`) for safe defaults on large scopes.
150+
- If `callees` shows little or no downstream detail for a function that mostly calls external libraries, switch to source reading for that boundary.
151+
101152
### Related Files
102153
```bash
103154
# Find siblings in hierarchy
@@ -240,6 +291,29 @@ recur files "main_command_<name>_*" -d src/ --sep _
240291
recur tree "main.command.<name>" -d docs/
241292
```
242293

294+
### Stale Eventness Detection
295+
296+
Eventness files are only useful while they are fresh:
297+
298+
- If both `.current` and `.complete` exist for the same work item, delete `.current` immediately.
299+
- If a `.current` file is old and no longer actionable, either refresh it with new resume context or close it.
300+
- Keep `.current` files concrete: last error, file/line, hypothesis, and next command.
301+
302+
```bash
303+
# Detect overlap/staleness
304+
recur files "**.current" -d docs/
305+
recur files "**.complete" -d docs/
306+
```
307+
308+
```powershell
309+
# Age check using git history (better than filesystem mtime)
310+
$files = recur files "**.current" -d docs/ | ConvertFrom-Json
311+
foreach ($f in $files) {
312+
$age = git log -1 --format="%ar" -- $f
313+
Write-Host "$age $f"
314+
}
315+
```
316+
243317
**3. Complete Work**
244318
```bash
245319
# Clean up ephemeral files
@@ -261,7 +335,7 @@ recur files "**.current" -d docs/
261335
- `main.improvement.<n>.todo.md` - Improvement tracking
262336

263337
**Ephemeral (delete when done):**
264-
- `main.command.<name>.todo.current.md` - Active work marker
338+
- `main.command.<name>.todo.current.md` - Active work marker with resume context (error, file/line, hypothesis, next step)
265339
- `main.command.<name>.todo.current.reference.md` - Reference pointer to working implementations
266340
- `main.command.<name>.todo.trigger.event.md` - Event commands to run at key moments
267341

@@ -566,6 +640,11 @@ recur files "main_command_<name>_*" -d src/ --sep _
566640
6. **Event-driven** - Run discovery commands at workflow events
567641
7. **Gap analysis** - Compare file sets to find missing work
568642
8. **Reference pattern** - Create `.reference.md` files pointing to working implementations
643+
9. **Search first for debugging** - Use `id/find/callers/callees/trace/trace-stats` before writing eventness docs
644+
10. **Use `id` for dot-path identifiers** - Prefer `recur id "prefix.**"` over plain text search for hierarchical identifiers
645+
11. **Stale detection is mandatory** - `.current` + `.complete` overlap means `.current` is stale
646+
12. **Skim then explore** - 5-minute doc skim prevents dead-end command loops
647+
13. **Mirror lanes in the same session** - if code changed, add/update docs/tests/automation lane state before ending the session
569648

570649
## Creating Good Reference Files
571650

@@ -736,6 +815,26 @@ cd julia-tests && julia runtests.jl
736815
recur tree "main" --sep . --sep _ --show-sep
737816
```
738817

818+
## Phase Lifecycle Checklist (Portable)
819+
820+
Use this for epics/phases in any project (not just this repo).
821+
822+
**Before phase start:**
823+
1. Create a `.todo.current.md` for active scope.
824+
2. Create a `.todo.current.reference.md` only if reusing an existing pattern.
825+
3. Create lane markers/scripts for verification lanes (tests, automation, DB checks) you will need.
826+
827+
**During phase:**
828+
1. Run discovery (`**.current`, tree for the epic prefix).
829+
2. Keep implementation and validation tight (`cargo test`, lane-specific tests/scripts).
830+
3. Update `.current` with concrete resume context after each significant checkpoint.
831+
832+
**After phase completion:**
833+
1. Delete `.current*` ephemerals.
834+
2. Add a concise `.complete.md` summary.
835+
3. Fold durable findings into persistent `.todo.md` or readme artifacts.
836+
4. Re-run discovery to confirm cleanup and expose the next visible gap.
837+
739838
## Cross-Lane Rule (Portable)
740839

741840
Treat code as canonical, then mirror intent across lanes in the same session:
@@ -758,6 +857,21 @@ When using a mirror lane (future/optional), keep the same order:
758857

759858
This prevents documentation-first drift and keeps eventness as durable evidence of real implementation state.
760859

860+
## Julia Verification Lane (Optional)
861+
862+
For data migration/verification-heavy projects, keep Julia scripts as a first-class lane:
863+
864+
- Prefer committed `.jl` scripts over inline shell snippets.
865+
- Default scripts to read-only checks.
866+
- Gate mutations behind `--fix`.
867+
868+
```bash
869+
julia jl/<name>.check.jl
870+
julia jl/<name>.check.jl --fix
871+
```
872+
873+
When reading SQL results in Julia, prefer SQL-side null handling (`COALESCE(...)`) to avoid brittle null coercion patterns in script code.
874+
761875
## Summary
762876

763877
You are a recur expert. You use recur commands to discover state, track work, and maintain external memory through hierarchical file structures. You understand the eventness pattern, separator awareness, and gap analysis. You never try to remember what can be queried.

0 commit comments

Comments
 (0)