Skip to content

Commit ea9e836

Browse files
authored
Merge pull request #257 from flyingrobots/graph-boaw
Graph BOAW
2 parents 94c4898 + 526bf9c commit ea9e836

186 files changed

Lines changed: 36970 additions & 1836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ban-nondeterminism-allowlist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ crates/warp-wasm/src/lib.rs
55
# This is intentional - WSC is for native tooling, not WASM determinism
66
crates/warp-core/src/wsc/mod.rs
77
crates/warp-core/src/wsc/view.rs
8+
# BOAW exec uses std::env for feature-gated stride fallback (ECHO_PARALLEL_STRIDE)
9+
# This is a build-time debug toggle, not runtime non-determinism
10+
crates/warp-core/src/boaw/exec.rs
11+
# engine_impl uses std::env for ECHO_WORKERS configuration
12+
# This is read once at engine construction for worker count - determinism is not affected
13+
# because the worker count doesn't change execution results, only parallelism level
14+
crates/warp-core/src/engine_impl.rs

.githooks/pre-commit

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -euo pipefail
55
# 0) Sweep stale build artifacts on odd hours (keeps target/ from ballooning)
66
# Manual: ./scripts/sweep-stale-artifacts.sh [days]
77
HOUR=$(date +%H)
8-
if (( HOUR % 2 == 1 )) && [[ -x scripts/sweep-stale-artifacts.sh ]]; then
8+
if (( 10#$HOUR % 2 == 1 )) && [[ -x scripts/sweep-stale-artifacts.sh ]]; then
99
scripts/sweep-stale-artifacts.sh 14
1010
fi
1111

@@ -123,12 +123,33 @@ if [[ -x scripts/ensure_spdx.sh ]]; then
123123
scripts/ensure_spdx.sh || exit 1
124124
fi
125125

126-
# 9) Markdown linting for staged .md files
127-
MD_FILES=$(echo "$STAGED" | grep -E '\.md$' || true)
128-
if [[ -n "$MD_FILES" ]] && command -v npx >/dev/null 2>&1; then
126+
# 9) Markdown formatting and linting for staged .md files
127+
# Use -z and --diff-filter=ACMRT to exclude deletions and handle whitespace safely
128+
mapfile -d '' MD_FILES < <(git diff --cached --name-only -z --diff-filter=ACMRT -- '*.md')
129+
if [[ ${#MD_FILES[@]} -gt 0 ]] && command -v npx >/dev/null 2>&1; then
129130
echo "pre-commit: linting markdown files"
130-
# shellcheck disable=SC2086
131-
if ! npx markdownlint-cli2 $MD_FILES; then
131+
132+
# Auto-format with prettier if ECHO_AUTO_FMT is enabled (handles tables, etc.)
133+
case "${_auto_fmt}" in
134+
1|true|TRUE|yes|YES|on|ON)
135+
# Check formatting; suppress stdout (file list) but preserve stderr for errors
136+
if npx prettier --check "${MD_FILES[@]}" >/dev/null; then
137+
: # Already formatted
138+
else
139+
echo "pre-commit: running prettier on markdown files" >&2
140+
# Write changes; suppress stdout but preserve stderr for errors
141+
if ! npx prettier --write "${MD_FILES[@]}" >/dev/null; then
142+
echo "pre-commit: prettier failed" >&2
143+
exit 1
144+
fi
145+
echo "pre-commit: prettier updated markdown files. Aborting commit to preserve index integrity." >&2
146+
echo "Hint: review changes, restage (e.g., 'git add -p' or 'git add -A'), then commit again." >&2
147+
exit 1
148+
fi
149+
;;
150+
esac
151+
152+
if ! npx markdownlint-cli2 "${MD_FILES[@]}"; then
132153
echo "pre-commit: markdown lint failed. Run: npx markdownlint-cli2 --fix <files>" >&2
133154
exit 1
134155
fi

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: cargo test (workspace)
7575
run: cargo test --workspace
7676
- name: PRNG golden regression (warp-core)
77-
run: cargo test -p warp-core --features golden_prng -- tests::next_int_golden_regression
77+
run: cargo test -p warp-core --features golden_prng --test prng_golden_regression
7878

7979
test-musl:
8080
name: Tests (musl)

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,32 @@ temp
4444
# Playwright artifacts
4545
test-results
4646
playwright-report
47+
48+
# LaTeX build artifacts (keep PDFs tracked)
49+
*.aux
50+
*.log
51+
*.toc
52+
*.lof
53+
*.lot
54+
*.fls
55+
*.fdb_latexmk
56+
*.synctex.gz
57+
*.xdv
58+
*.ps
59+
*.dvi
60+
*.out
61+
*.nav
62+
*.snm
63+
*.vrb
64+
*.run.xml
65+
*.bbl
66+
*.blg
67+
*.bcf
68+
*.idx
69+
*.ind
70+
*.ilg
71+
*.lbx
72+
_minted*
73+
74+
# Experimental benchmark binaries (not ready for CI)
75+
crates/warp-benches/src/bin/

.markdownlint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2+
"MD007": { "indent": 4 },
23
"MD013": false,
34
"MD033": {
4-
"allowed_elements": ["u8", "br", "p", "img"]
5+
"allowed_elements": ["u8", "br", "p", "img", "a", "strong", "sub"]
56
},
67
"MD041": false,
78
"MD046": {

AGENTS.md

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- SPDX-License-Identifier: Apache-2.0 OR MIND-UCAL-1.0 -->
22
<!-- © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots> -->
3+
34
# Echo Agent Briefing
45

56
Welcome to the **Echo** project. This file captures expectations for any LLM agent (and future-human collaborator) who touches the repo.
@@ -17,6 +18,106 @@ Welcome to the **Echo** project. This file captures expectations for any LLM age
1718
- Capture milestones, blockers, and decisions in relevant specs, ADRs, or PR descriptions.
1819
- AGENTS.md and `TASKS-DAG.md` are append-only; see `docs/append-only-invariants.md` plus `scripts/check-append-only.js` for the enforcement plan that CI will run before merges.
1920

21+
## Agent Context System (2-Tier)
22+
23+
Agents use a **2-tier context system** to maintain continuity across sessions:
24+
25+
| Tier | Store | Purpose | Update Frequency |
26+
| ------------- | --------------- | ------------------------------------------ | -------------------------------- |
27+
| **Immediate** | Redis stream | Current task state, branch, blockers | Every significant action |
28+
| **Deep** | Knowledge graph | Architecture decisions, patterns, entities | When learning something reusable |
29+
30+
### Session Start (Bootstrap)
31+
32+
1. **Read this file** (`AGENTS.md`) for project conventions
33+
34+
2. **Check Redis handoff stream**: `echo:agent:handoff` (most recent entry)
35+
36+
```text
37+
XRANGE echo:agent:handoff - + COUNT 5
38+
```
39+
40+
3. **Query knowledge graph** for relevant entities:
41+
42+
```python
43+
search_nodes("<feature_name>") # e.g., "BOAW", "MaterializationBus"
44+
search_nodes("Echo") # General project context
45+
```
46+
47+
### During Work (Continuous Updates)
48+
49+
**Redis stream** — Update after every significant action:
50+
51+
- Completing a task or subtask
52+
- Encountering a blocker
53+
- Making a key decision
54+
- Changing branches or PRs
55+
56+
```bash
57+
XADD echo:agent:handoff * \
58+
branch "graph-boaw" \
59+
status "IN_PROGRESS" \
60+
summary "Fixing determinism bug in view op emission" \
61+
current_task "Updating emit_view_op_delta_scoped()" \
62+
blockers "none" \
63+
timestamp "<ISO-8601 timestamp>"
64+
```
65+
66+
**Knowledge graph** — Create/update entities when you:
67+
68+
- Discover an architectural pattern worth preserving
69+
- Complete a milestone (create `<Feature>_Phase<N>` entity)
70+
- Fix a non-obvious bug (create `<Feature>_BugFix` entity)
71+
- Make a decision that future agents should know about
72+
73+
```json
74+
{
75+
"name": "BOAW_Determinism_Fix",
76+
"entityType": "BugFix",
77+
"observations": [
78+
"Root cause: emit_view_op_delta() used delta.len() for view op IDs",
79+
"delta.len() is worker-local and varies by shard claim order",
80+
"Fix: derive op ID from intent scope (NodeId) which is content-addressed"
81+
]
82+
}
83+
```
84+
85+
### Session End (Handoff)
86+
87+
Before ending a session, **always** write a handoff entry:
88+
89+
```bash
90+
XADD echo:agent:handoff * \
91+
branch "<current-branch>" \
92+
status "<COMPLETE|IN_PROGRESS|BLOCKED>" \
93+
summary "<1-2 sentence summary of what was done>" \
94+
commits "<recent commit hashes and messages>" \
95+
next_steps "<what the next agent should do>" \
96+
blockers "<any blockers, or 'none'>" \
97+
tech_debt "<any shortcuts taken that need cleanup>" \
98+
test_commands "<commands to verify the work>" \
99+
timestamp "<ISO-8601 timestamp>"
100+
```
101+
102+
### Key Entities to Know
103+
104+
The knowledge graph contains ~300+ entities built by prior agents. Key patterns:
105+
106+
- `Echo Project` — Core project info and current focus
107+
- `<Feature>_Architecture` — Design decisions for major features
108+
- `<Feature>_Phase<N>` — Milestone completion records
109+
- `<Feature>_BugFix` — Non-obvious bug fixes worth remembering
110+
- `<Feature>_Tech_Debt_P<N>` — Tracked technical debt by priority
111+
112+
### Why This Matters
113+
114+
- **Quick tasks**: Redis handoff alone may suffice
115+
- **Complex tasks**: Query knowledge graph for architectural context
116+
- **Debugging**: Search for prior bug fixes in similar areas
117+
- **Decisions**: Check if prior agents already explored an approach
118+
119+
The 2-tier system means handoffs are seamless—no context is lost between agents, and institutional knowledge accumulates over time.
120+
20121
## Workflows & Automation
21122

22123
- The contributor playbook lives in `docs/workflows.md` (policy + blessed commands + automation).
@@ -42,9 +143,9 @@ Welcome to the **Echo** project. This file captures expectations for any LLM age
42143
### PRs & Issues (Linkage Policy)
43144

44145
- Every PR must be tied to a GitHub Issue.
45-
- If no suitable issue exists, open one before you open the PR.
46-
- Use explicit closing keywords in the PR body: include a line like `Closes #<issue-number>` so the issue auto‑closes on merge.
47-
- Keep PRs single‑purpose: 1 PR = 1 thing. Avoid bundling unrelated changes.
146+
- If no suitable issue exists, open one before you open the PR.
147+
- Use explicit closing keywords in the PR body: include a line like `Closes #<issue-number>` so the issue auto‑closes on merge.
148+
- Keep PRs single‑purpose: 1 PR = 1 thing. Avoid bundling unrelated changes.
48149
- Branch naming: prefer `echo/<short-feature-name>` or `timeline/<experiment>` and include the issue number in the PR title.
49150
- Project hygiene: assign the PR's linked issue to the correct Milestone and Board column (Blocked/Ready/Done) as part of the PR.
50151

@@ -54,9 +155,9 @@ Welcome to the **Echo** project. This file captures expectations for any LLM age
54155
- Formatting: pre-commit auto-fixes with `cargo fmt` by default. Set `ECHO_AUTO_FMT=0` to run check-only instead.
55156
- Toolchain: pre-commit verifies your active toolchain matches `rust-toolchain.toml`.
56157
- SPDX header policy (source): every source file must start with exactly:
57-
- `// SPDX-License-Identifier: Apache-2.0`
58-
- `// © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots>`
59-
Use the repository scripts/hooks; do not add dual-license headers to code.
158+
- `// SPDX-License-Identifier: Apache-2.0`
159+
- `// © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots>`
160+
Use the repository scripts/hooks; do not add dual-license headers to code.
60161

61162
## Git Real
62163

0 commit comments

Comments
 (0)