Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .devkit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# devkit configuration — used by https://github.com/rararulab/devkit
# Install: go install github.com/rararulab/devkit@latest

[agent-md]
crates_dir = "crates"

[deps]
crates_dir = "crates"

# Layer assignments for dependency direction checking.
# A crate at layer N must NOT depend on a crate at layer N+1 or higher.
# Key = layer number (0 = lowest), value = list of crate package names.
[deps.layers]
0 = [
"base",
"rara-error",
"common-runtime",
"common-telemetry",
"common-worker",
"yunara-store",
"rara-tool-macro",
"crawl4ai",
"rara-paths",
"rara-model",
"rara-domain-shared",
"rara-api",
]
1 = [
"rara-soul",
"rara-symphony",
"rara-skills",
"rara-vault",
"rara-composio",
"rara-keyring-store",
"rara-codex-oauth",
"rara-git",
]
2 = ["rara-kernel"]
3 = [
"rara-dock",
"rara-sessions",
"rara-agents",
"rara-mcp",
"rara-pg-credential-store",
]
4 = ["rara-channels", "rara-backend-admin"]
5 = ["rara-app", "rara-server"]
6 = ["rara-cli"]
24 changes: 2 additions & 22 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,39 +45,19 @@ jobs:
- name: Buf format check
run: cd api && buf format --diff --exit-code

devtool-checks:
name: Devtool Checks
runs-on: arc-runner-set
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
persist-credentials: false

- name: Build devtool
run: cd scripts && go build -o bin/devtool ./cmd/devtool/

- name: Check AGENT.md existence
run: scripts/bin/devtool check-agent-md

- name: Check crate dependency direction
run: scripts/bin/devtool check-deps

lint-success:
name: Lint Success
runs-on: arc-runner-set
needs: [rust-format, proto-lint, devtool-checks]
needs: [rust-format, proto-lint]
if: always()
steps:
- name: Check all lint jobs status
env:
RUST_FORMAT_RESULT: ${{ needs.rust-format.result }}
PROTO_LINT_RESULT: ${{ needs.proto-lint.result }}
DEVTOOL_CHECKS_RESULT: ${{ needs.devtool-checks.result }}
run: |
if [[ "$RUST_FORMAT_RESULT" != "success" || \
"$PROTO_LINT_RESULT" != "success" || \
"$DEVTOOL_CHECKS_RESULT" != "success" ]]; then
"$PROTO_LINT_RESULT" != "success" ]]; then
echo "One or more lint jobs failed"
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:

- id: check-agent-md
name: check AGENT.md presence
entry: go run ./scripts/cmd/devtool/ check-agent-md
entry: devkit check-agent-md
language: system
pass_filenames: false
files: ^crates/
Expand Down
43 changes: 27 additions & 16 deletions docs/src/harness-engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ Three principles guide our approach:
2. **Waiting is expensive; corrections are cheap.** We use minimal blocking gates at commit time and continuous quality tracking on `main`.
3. **Build the missing capability into the repo.** When an agent struggles, the fix is never "try harder" — it's making the codebase more legible and enforceable.

## Devtool Commands
## Devkit Commands

All enforcement tools live as subcommands of the Go-based `devtool` CLI under `scripts/`.
Enforcement tools are provided by [devkit](https://github.com/rararulab/devkit), a standalone Go CLI. Install with `go install github.com/rararulab/devkit@latest`. Configuration lives in `.devkit.toml` at the repo root.

### `devtool check-agent-md`
### `devkit check-agent-md`

Verifies every crate under `crates/` has an `AGENT.md` file. AGENT.md files are the primary way agents understand a crate's purpose, invariants, and anti-patterns without reading every source file.

```bash
just check-agent-md # Run standalone
scripts/bin/devtool check-agent-md
devkit check-agent-md
```

**Runs in:** PR lint CI (blocking).
**Runs in:** pre-commit hook (blocking).

### `devtool check-deps`
### `devkit check-deps`

Validates crate dependency direction against a 7-layer architecture map. Lower-layer crates must not depend on higher-layer crates:
Validates crate dependency direction against a 7-layer architecture map defined in `.devkit.toml`. Lower-layer crates must not depend on higher-layer crates:

```
Layer 0 (foundation) → common/*, paths, rara-model, domain/*, rara-api
Expand All @@ -45,17 +45,28 @@ Layer 6 (entry) → rara-cli

```bash
just check-deps # Run standalone
scripts/bin/devtool check-deps
devkit check-deps
```

**Runs in:** PR lint CI (blocking).
**Runs in:** pre-commit hook (blocking).

### `devkit wt`

Interactive worktree manager TUI. Provides selection, bulk cleanup of merged worktrees, pruning, and disk size reporting.

```bash
just wt # Launch TUI
devkit wt list # Non-interactive list
devkit wt clean # Remove merged worktrees
devkit wt nuke # Force-remove all except main
```

## CI Integration

| Check | Trigger | Blocking? | Purpose |
|-------|---------|-----------|---------|
| `check-agent-md` | PR lint | Yes | Prevent crates without agent guidelines |
| `check-deps` | PR lint | Yes | Prevent architecture layer violations |
| `check-agent-md` | Pre-commit hook | Yes | Prevent crates without agent guidelines |
| `check-deps` | Pre-commit hook | Yes | Prevent architecture layer violations |
| `cargo clippy -D warnings` | PR lint | Yes | Code quality |
| `cargo +nightly fmt --check` | PR lint | Yes | Formatting consistency |
| `buf lint` | PR lint | Yes | Protobuf schema quality |
Expand All @@ -65,10 +76,10 @@ scripts/bin/devtool check-deps

When you identify a rule that agents frequently violate:

1. Create a `scripts/internal/<name>/commands.go` subcommand
2. Register it in `scripts/cmd/devtool/main.go`
3. Add a `just` recipe in `justfile`
4. Add a CI job in `.github/workflows/lint.yml`
5. Decide: **blocking** (PR gate) or **tracking** (main-only report)?
1. Add a new subcommand in [devkit](https://github.com/rararulab/devkit) under `internal/<name>/commands.go`
2. Register it in `main.go`
3. Add a `just` recipe in this repo's `justfile`
4. Optionally add a pre-commit hook in `.pre-commit-config.yaml`
5. Decide: **blocking** (pre-commit gate) or **tracking** (main-only report)?

The bar for blocking checks is high — they must be deterministic, fast, and have zero false positives. Quality tracking checks can be softer.
18 changes: 5 additions & 13 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ alias t := test
[doc("check that every crate has an AGENT.md")]
[group("👆 Code Quality")]
check-agent-md:
@cd scripts && go build -o bin/devtool ./cmd/devtool/
@scripts/bin/devtool check-agent-md
@devkit check-agent-md

[doc("run linting checks (clippy, docs, buf, zizmor, yamllint-rs, cargo-deny, agent-md, check-deps)")]
[group("👆 Code Quality")]
Expand Down Expand Up @@ -311,22 +310,15 @@ alias ma := migrate-add
# Worktree Management
# ========================================================================================

DEVTOOL := "scripts/bin/devtool"

[doc("build devtool binary")]
[group("🔧 Development")]
devtool-build:
@cd scripts && go build -o bin/devtool ./cmd/devtool/

[doc("interactive worktree manager (TUI)")]
[group("🌳 Worktree")]
wt: devtool-build
@{{DEVTOOL}} wt
wt:
@devkit wt

[doc("check crate dependency direction rules")]
[group("👆 Code Quality")]
check-deps: devtool-build
@{{DEVTOOL}} check-deps
check-deps:
@devkit check-deps

# ========================================================================================
# Dependency Management
Expand Down
37 changes: 0 additions & 37 deletions scripts/AGENT.md

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/cmd/devtool/main.go

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/go.mod

This file was deleted.

54 changes: 0 additions & 54 deletions scripts/go.sum

This file was deleted.

Loading