diff --git a/.githooks/post-checkout b/.githooks/post-checkout new file mode 100755 index 00000000..573833dd --- /dev/null +++ b/.githooks/post-checkout @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$({ + cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd +})" + +"$repo_root/scripts/ensure_agent_hardlinks.sh" >/dev/null diff --git a/.githooks/post-merge b/.githooks/post-merge new file mode 100755 index 00000000..573833dd --- /dev/null +++ b/.githooks/post-merge @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$({ + cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd +})" + +"$repo_root/scripts/ensure_agent_hardlinks.sh" >/dev/null diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 120000 index be77ac83..00000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1 +0,0 @@ -../AGENTS.md \ No newline at end of file diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..61cb6e0b --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,216 @@ +# AGENTS.md + +> Canonical AI agent instructions for ColdVox. All tools (Claude Code, Copilot, Cursor, Kilo Code, etc.) should read this file. + +> **⚠️ CRITICAL**: Some documented features are broken or removed. See [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) before following STT instructions. + +> **Solo-dev trust model**: This repo is effectively single-developer. We optimize for local productivity/automation over “untrusted contributor” safety. If a tool/setup step enables automation (e.g., repo-managed git hooks), that’s intentional. + +## Key Docs + +- [`README.md`](README.md) - Project overview and quick start +- [`CLAUDE.md`](CLAUDE.md) - Deep-dive guide (Claude-specific + imports AGENTS) +- [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) - What’s currently broken/misleading +- [`docs/dev/CI/architecture.md`](docs/dev/CI/architecture.md) - CI runner split and rationale +- [`docs/standards.md`](docs/standards.md) - Documentation + changelog standards +- [`docs/MasterDocumentationPlaybook.md`](docs/MasterDocumentationPlaybook.md) - Documentation structure and rules + +## Project Overview + +ColdVox is a Rust-based voice AI pipeline: audio capture → VAD → STT → text injection. Multi-crate Cargo workspace under `crates/`. + +**Key crates**: `coldvox-app` (main), `coldvox-audio`, `coldvox-vad`, `coldvox-vad-silero`, `coldvox-stt`, `coldvox-text-injection`, `coldvox-telemetry`, `coldvox-foundation`, `coldvox-gui` + +## Worktrees + +Use git worktrees for parallel agent work. This allows multiple agents to work on independent tasks simultaneously. + +```bash +# Create worktree for a new task +git worktree add ../.trees/coldvox-{task} -b {task} +cd ../.trees/coldvox-{task} + +# List all worktrees +git worktree list + +# Remove when done (after merge) +git worktree remove ../.trees/coldvox-{task} +``` + +**Convention**: Worktrees live in `../.trees/coldvox-{branch-name}` to keep them adjacent but separate. + +## Commands + +### File-Scoped (Preferred) + +Always prefer file/crate-scoped commands over full workspace commands for faster feedback: + +```bash +# Type check single crate +cargo check -p coldvox-stt + +# Clippy single crate +cargo clippy -p coldvox-audio +# Test single crate +cargo test -p coldvox-text-injection + +# Format check (always full, it's fast) +cargo fmt --all -- --check +``` + +### Full Workspace (When Needed) + +```bash +just lint # fmt + clippy + check (pre-push) +just test # cargo test --workspace --locked +just build # cargo build --workspace --locked +just ci # Full CI mirror via ./scripts/local_ci.sh +``` + +### Running + +```bash +just run # Main app +just tui # TUI dashboard +cargo run --features text-injection # Text injection enabled +``` + +## Do + +- Use `just lint` before every push +- Prefer crate-scoped commands for faster iteration +- Use feature flags: `whisper`, `parakeet`, `text-injection`, `silero` +- Follow Conventional Commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:` +- Run `cargo fmt --all` before committing +- Add tests for new functionality +- Update `CHANGELOG.md` for user-visible changes (see `docs/standards.md`) + +## Don't + +- Don't run full workspace builds when crate-scoped works +- Don't commit secrets or `.env` files +- Don't edit generated code under `target/` +- Don't add heavy dependencies without discussion +- Don't skip `just lint` before pushing +- Don't create `docs/agents.md` - agent config lives at repo root + +## Project Structure + +``` +crates/ + app/ # Main application, binaries, integration + coldvox-audio/ # Audio capture, ring buffer, resampling + coldvox-vad/ # VAD traits and config + coldvox-vad-silero/ # Silero V5 ONNX VAD implementation + coldvox-stt/ # STT abstractions and plugins (Whisper, Parakeet) + coldvox-text-injection/ # Platform-specific text injection backends + coldvox-telemetry/ # Pipeline metrics + coldvox-foundation/ # Core types, error handling, shutdown + coldvox-gui/ # GUI components + +config/ # Runtime configuration +docs/ # Documentation (see MasterDocumentationPlaybook.md) +scripts/ # Automation scripts +``` + +## Feature Flags + +Default: `silero`, `text-injection` + +- `whisper` - Faster-Whisper STT (Python-based, CPU/GPU) +- `parakeet` - NVIDIA Parakeet STT (GPU-only, pure Rust) +- `text-injection` - Platform-aware text injection +- `silero` - Silero V5 ONNX VAD (default) +- `examples` - Example binaries +- `live-hardware-tests` - Hardware test suites + +## Safety & Permissions + +**Allowed without prompt:** +- Read files, list files, search code +- Crate-scoped: check, clippy, test, fmt +- Git status, diff, log + +**Ask first:** +- Package/dependency changes +- Git push, force operations +- Deleting files +- Full workspace builds (prefer crate-scoped) +- Database migrations +- Running with hardware features + +## When Stuck + +- Ask a clarifying question +- Propose a short plan before large changes +- Open a draft PR with notes +- Don't push large speculative changes without confirmation + +## Key Files + +- **Main entry**: `crates/app/src/main.rs` +- **Audio pipeline**: `crates/coldvox-audio/src/capture.rs` +- **VAD engine**: `crates/coldvox-vad-silero/src/silero_wrapper.rs` +- **STT plugins**: `crates/coldvox-stt/src/plugins/` +- **Text injection**: `crates/coldvox-text-injection/src/manager.rs` +- **Build detection**: `crates/app/build.rs` (platform detection) + +## Documentation + +- `docs/MasterDocumentationPlaybook.md` - Documentation standards +- `docs/standards.md` - Changelog rubric, metadata requirements +- `docs/architecture.md` - System design and future vision +- `docs/domains/` - Domain-specific technical docs + +## CI Environment + +> **Principle**: The self hosted runner on the laptop is used for hardware tests, CI for everything else. + +See [CI Architecture](docs/dev/CI/architecture.md) for full details. + +### Self-Hosted Runner (Fedora/Nobara) + +| Fact | Implication | +|------|-------------| +| **Live KDE Plasma session** | NO Xvfb needed. Use real `$DISPLAY`. | +| **Fedora-based** | `apt-get` does NOT exist. Use `dnf`. | +| **Always available** | Auto-login, survives reboots. | +| **Warm sccache** | Incremental builds ~2-3 min. | + +### CI Split + +| Task | Runner | Why | +|------|--------|-----| +| `cargo fmt`, `cargo clippy` | GitHub-hosted | Fast, parallel, free | +| `cargo audit`, `cargo deny` | GitHub-hosted | Security checks, no build needed | +| `cargo build` | **Self-hosted** | Warm cache, THE build | +| Hardware tests | **Self-hosted** | Requires display/audio/clipboard | + +### DON'T (Common AI Mistakes) + +```yaml +# WRONG - runner has live display, also uses apt-get internally +- uses: GabrielBB/xvfb-action@v1 + +# WRONG - this is Fedora, not Ubuntu +- run: sudo apt-get install -y xdotool + +# WRONG - real display is :0 +env: + DISPLAY: ":99" + +# WRONG - delays self-hosted by 5-10 min +hardware: + needs: [lint, build] + +# WRONG - wasted work, can't share artifacts with Fedora +- run: cargo build # On ubuntu-latest +``` + +## PR Checklist + +- [ ] `just lint` passes +- [ ] `just test` passes (or crate-scoped tests) +- [ ] Changelog updated if user-visible +- [ ] Commit messages follow Conventional Commits +- [ ] No secrets or sensitive data diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index 89786a64..3a407d50 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -39,6 +39,11 @@ jobs: run: | uv run scripts/validate_docs.py "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" + - name: Validate agent instruction mirrors + run: | + diff -u AGENTS.md .github/copilot-instructions.md + diff -u AGENTS.md .kilocode/rules/agents.md + - name: Append revision log entries run: | uv run scripts/docs_revision_logger.py "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" "${{ github.actor }}" diff --git a/.kilocode/rules/agents.md b/.kilocode/rules/agents.md deleted file mode 120000 index b7e6491d..00000000 --- a/.kilocode/rules/agents.md +++ /dev/null @@ -1 +0,0 @@ -../../AGENTS.md \ No newline at end of file diff --git a/.kilocode/rules/agents.md b/.kilocode/rules/agents.md new file mode 100644 index 00000000..61cb6e0b --- /dev/null +++ b/.kilocode/rules/agents.md @@ -0,0 +1,216 @@ +# AGENTS.md + +> Canonical AI agent instructions for ColdVox. All tools (Claude Code, Copilot, Cursor, Kilo Code, etc.) should read this file. + +> **⚠️ CRITICAL**: Some documented features are broken or removed. See [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) before following STT instructions. + +> **Solo-dev trust model**: This repo is effectively single-developer. We optimize for local productivity/automation over “untrusted contributor” safety. If a tool/setup step enables automation (e.g., repo-managed git hooks), that’s intentional. + +## Key Docs + +- [`README.md`](README.md) - Project overview and quick start +- [`CLAUDE.md`](CLAUDE.md) - Deep-dive guide (Claude-specific + imports AGENTS) +- [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) - What’s currently broken/misleading +- [`docs/dev/CI/architecture.md`](docs/dev/CI/architecture.md) - CI runner split and rationale +- [`docs/standards.md`](docs/standards.md) - Documentation + changelog standards +- [`docs/MasterDocumentationPlaybook.md`](docs/MasterDocumentationPlaybook.md) - Documentation structure and rules + +## Project Overview + +ColdVox is a Rust-based voice AI pipeline: audio capture → VAD → STT → text injection. Multi-crate Cargo workspace under `crates/`. + +**Key crates**: `coldvox-app` (main), `coldvox-audio`, `coldvox-vad`, `coldvox-vad-silero`, `coldvox-stt`, `coldvox-text-injection`, `coldvox-telemetry`, `coldvox-foundation`, `coldvox-gui` + +## Worktrees + +Use git worktrees for parallel agent work. This allows multiple agents to work on independent tasks simultaneously. + +```bash +# Create worktree for a new task +git worktree add ../.trees/coldvox-{task} -b {task} +cd ../.trees/coldvox-{task} + +# List all worktrees +git worktree list + +# Remove when done (after merge) +git worktree remove ../.trees/coldvox-{task} +``` + +**Convention**: Worktrees live in `../.trees/coldvox-{branch-name}` to keep them adjacent but separate. + +## Commands + +### File-Scoped (Preferred) + +Always prefer file/crate-scoped commands over full workspace commands for faster feedback: + +```bash +# Type check single crate +cargo check -p coldvox-stt + +# Clippy single crate +cargo clippy -p coldvox-audio +# Test single crate +cargo test -p coldvox-text-injection + +# Format check (always full, it's fast) +cargo fmt --all -- --check +``` + +### Full Workspace (When Needed) + +```bash +just lint # fmt + clippy + check (pre-push) +just test # cargo test --workspace --locked +just build # cargo build --workspace --locked +just ci # Full CI mirror via ./scripts/local_ci.sh +``` + +### Running + +```bash +just run # Main app +just tui # TUI dashboard +cargo run --features text-injection # Text injection enabled +``` + +## Do + +- Use `just lint` before every push +- Prefer crate-scoped commands for faster iteration +- Use feature flags: `whisper`, `parakeet`, `text-injection`, `silero` +- Follow Conventional Commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:` +- Run `cargo fmt --all` before committing +- Add tests for new functionality +- Update `CHANGELOG.md` for user-visible changes (see `docs/standards.md`) + +## Don't + +- Don't run full workspace builds when crate-scoped works +- Don't commit secrets or `.env` files +- Don't edit generated code under `target/` +- Don't add heavy dependencies without discussion +- Don't skip `just lint` before pushing +- Don't create `docs/agents.md` - agent config lives at repo root + +## Project Structure + +``` +crates/ + app/ # Main application, binaries, integration + coldvox-audio/ # Audio capture, ring buffer, resampling + coldvox-vad/ # VAD traits and config + coldvox-vad-silero/ # Silero V5 ONNX VAD implementation + coldvox-stt/ # STT abstractions and plugins (Whisper, Parakeet) + coldvox-text-injection/ # Platform-specific text injection backends + coldvox-telemetry/ # Pipeline metrics + coldvox-foundation/ # Core types, error handling, shutdown + coldvox-gui/ # GUI components + +config/ # Runtime configuration +docs/ # Documentation (see MasterDocumentationPlaybook.md) +scripts/ # Automation scripts +``` + +## Feature Flags + +Default: `silero`, `text-injection` + +- `whisper` - Faster-Whisper STT (Python-based, CPU/GPU) +- `parakeet` - NVIDIA Parakeet STT (GPU-only, pure Rust) +- `text-injection` - Platform-aware text injection +- `silero` - Silero V5 ONNX VAD (default) +- `examples` - Example binaries +- `live-hardware-tests` - Hardware test suites + +## Safety & Permissions + +**Allowed without prompt:** +- Read files, list files, search code +- Crate-scoped: check, clippy, test, fmt +- Git status, diff, log + +**Ask first:** +- Package/dependency changes +- Git push, force operations +- Deleting files +- Full workspace builds (prefer crate-scoped) +- Database migrations +- Running with hardware features + +## When Stuck + +- Ask a clarifying question +- Propose a short plan before large changes +- Open a draft PR with notes +- Don't push large speculative changes without confirmation + +## Key Files + +- **Main entry**: `crates/app/src/main.rs` +- **Audio pipeline**: `crates/coldvox-audio/src/capture.rs` +- **VAD engine**: `crates/coldvox-vad-silero/src/silero_wrapper.rs` +- **STT plugins**: `crates/coldvox-stt/src/plugins/` +- **Text injection**: `crates/coldvox-text-injection/src/manager.rs` +- **Build detection**: `crates/app/build.rs` (platform detection) + +## Documentation + +- `docs/MasterDocumentationPlaybook.md` - Documentation standards +- `docs/standards.md` - Changelog rubric, metadata requirements +- `docs/architecture.md` - System design and future vision +- `docs/domains/` - Domain-specific technical docs + +## CI Environment + +> **Principle**: The self hosted runner on the laptop is used for hardware tests, CI for everything else. + +See [CI Architecture](docs/dev/CI/architecture.md) for full details. + +### Self-Hosted Runner (Fedora/Nobara) + +| Fact | Implication | +|------|-------------| +| **Live KDE Plasma session** | NO Xvfb needed. Use real `$DISPLAY`. | +| **Fedora-based** | `apt-get` does NOT exist. Use `dnf`. | +| **Always available** | Auto-login, survives reboots. | +| **Warm sccache** | Incremental builds ~2-3 min. | + +### CI Split + +| Task | Runner | Why | +|------|--------|-----| +| `cargo fmt`, `cargo clippy` | GitHub-hosted | Fast, parallel, free | +| `cargo audit`, `cargo deny` | GitHub-hosted | Security checks, no build needed | +| `cargo build` | **Self-hosted** | Warm cache, THE build | +| Hardware tests | **Self-hosted** | Requires display/audio/clipboard | + +### DON'T (Common AI Mistakes) + +```yaml +# WRONG - runner has live display, also uses apt-get internally +- uses: GabrielBB/xvfb-action@v1 + +# WRONG - this is Fedora, not Ubuntu +- run: sudo apt-get install -y xdotool + +# WRONG - real display is :0 +env: + DISPLAY: ":99" + +# WRONG - delays self-hosted by 5-10 min +hardware: + needs: [lint, build] + +# WRONG - wasted work, can't share artifacts with Fedora +- run: cargo build # On ubuntu-latest +``` + +## PR Checklist + +- [ ] `just lint` passes +- [ ] `just test` passes (or crate-scoped tests) +- [ ] Changelog updated if user-visible +- [ ] Commit messages follow Conventional Commits +- [ ] No secrets or sensitive data diff --git a/AGENTS.md b/AGENTS.md index bb1b989f..61cb6e0b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,18 @@ > Canonical AI agent instructions for ColdVox. All tools (Claude Code, Copilot, Cursor, Kilo Code, etc.) should read this file. -> **⚠️ CRITICAL**: Some documented features are broken or removed. See [`criticalActionPlan.md`](criticalActionPlan.md) before following STT instructions. +> **⚠️ CRITICAL**: Some documented features are broken or removed. See [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) before following STT instructions. + +> **Solo-dev trust model**: This repo is effectively single-developer. We optimize for local productivity/automation over “untrusted contributor” safety. If a tool/setup step enables automation (e.g., repo-managed git hooks), that’s intentional. + +## Key Docs + +- [`README.md`](README.md) - Project overview and quick start +- [`CLAUDE.md`](CLAUDE.md) - Deep-dive guide (Claude-specific + imports AGENTS) +- [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) - What’s currently broken/misleading +- [`docs/dev/CI/architecture.md`](docs/dev/CI/architecture.md) - CI runner split and rationale +- [`docs/standards.md`](docs/standards.md) - Documentation + changelog standards +- [`docs/MasterDocumentationPlaybook.md`](docs/MasterDocumentationPlaybook.md) - Documentation structure and rules ## Project Overview @@ -61,7 +72,7 @@ just ci # Full CI mirror via ./scripts/local_ci.sh ```bash just run # Main app just tui # TUI dashboard -cargo run --features whisper,text-injection # With STT +cargo run --features text-injection # Text injection enabled ``` ## Do diff --git a/CLAUDE.md b/CLAUDE.md index 0ffc5dcc..bb73ee4e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with this repository. -> **⚠️ CRITICAL**: STT documentation below is outdated. Whisper is removed, Parakeet broken. See [`criticalActionPlan.md`](criticalActionPlan.md). **Only Moonshine works.** +> **⚠️ CRITICAL**: STT documentation below is outdated. Whisper is removed, Parakeet broken. See [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md). **Only Moonshine works.** **@import AGENTS.md** - Read `AGENTS.md` for canonical project instructions (structure, commands, do/don't rules, worktrees). diff --git a/README.md b/README.md index ffc65db9..a20604e1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ColdVox > ⚠️ **Internal Alpha** - This project is in early development and not ready for production use. -> **⚠️ CRITICAL**: Documentation is out of sync with code. Whisper STT has been removed; Parakeet doesn't compile. See [`criticalActionPlan.md`](criticalActionPlan.md) for current status. **Only Moonshine STT works** (requires `uv sync` first). +> **⚠️ CRITICAL**: Documentation is out of sync with code. Whisper STT has been removed; Parakeet doesn't compile. See [`docs/plans/critical-action-plan.md`](docs/plans/critical-action-plan.md) for current status. **Only Moonshine STT works** (requires `uv sync` first). ## Development - Install Rust (stable) and required system dependencies for your platform. - Use the provided scripts in `scripts/` to help with local environment setup. @@ -113,4 +113,4 @@ Dual-licensed under MIT or Apache-2.0. See `LICENSE-MIT` and `LICENSE-APACHE` if - Review the [Master Documentation Playbook](docs/MasterDocumentationPlaybook.md). - Follow the repository [Documentation Standards](docs/standards.md). - Coordinate work through the [Documentation Todo Backlog](docs/todo.md). -- Assistants should read the [Assistant Interaction Index](docs/agents.md). +- Assistants should read [`AGENTS.md`](AGENTS.md). diff --git a/docs/architecture.md b/docs/architecture.md index 6a79f848..e5a656f9 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -9,13 +9,13 @@ last_reviewed: 2025-10-19 # ColdVox Architecture & Future Vision -> **⚠️ CRITICAL**: STT backend status has changed. See [`../criticalActionPlan.md`](../criticalActionPlan.md) for current working features. +> **⚠️ CRITICAL**: STT backend status has changed. See [`plans/critical-action-plan.md`](plans/critical-action-plan.md) for current working features. ## Navigation - [Architecture Roadmap](./architecture/roadmap.md) - [Architecture Decisions](./architecture/adr/) -- [Critical Action Plan](../criticalActionPlan.md) - Current broken features tracking +- [Critical Action Plan](plans/critical-action-plan.md) - Current broken features tracking diff --git a/docs/architecture/roadmap.md b/docs/architecture/roadmap.md index 7c3f57b7..b6fa24b5 100644 --- a/docs/architecture/roadmap.md +++ b/docs/architecture/roadmap.md @@ -53,7 +53,7 @@ This roadmap outlines the anticipated progression of major transformational init ## Next Actions (Short-Term) -1. Finalize `docs/standards.md`, `docs/agents.md`, and playbook skeletons. +1. Finalize `docs/standards.md`, `AGENTS.md`, and playbook skeletons. 2. Land GitHub governance automation plans in `docs/playbooks/organizational/github_governance.md`. 3. Prototype docs watcher tooling and integrate logs into CI for visibility. 4. Draft the always-on listening proof-of-concept design notes and spike tickets for v1.0 foundation work. diff --git a/criticalActionPlan.md b/docs/plans/critical-action-plan.md similarity index 100% rename from criticalActionPlan.md rename to docs/plans/critical-action-plan.md diff --git a/docs/plans/documentation/future-documentation-architecture.md b/docs/plans/documentation/future-documentation-architecture.md index 67c6ca15..8cbd387a 100644 --- a/docs/plans/documentation/future-documentation-architecture.md +++ b/docs/plans/documentation/future-documentation-architecture.md @@ -87,7 +87,7 @@ docs/ - **Audience**: All contributors - **Enforcement**: CI validation -#### 3. Agent Guidelines (`docs/agents.md`) +#### 3. Agent Guidelines (`AGENTS.md`) - **Purpose**: Optimize documentation for AI assistants - **Content**: Documentation index, search patterns, contribution guidelines - **Audience**: AI agents (Claude, GitHub Copilot, etc.) @@ -166,7 +166,7 @@ last_reviewed: [YYYY-MM-DD] ### For AI Agents - **Predictable Structure**: Domain-based organization matches code structure -- **Comprehensive Index**: `docs/agents.md` provides navigation guidance +- **Comprehensive Index**: `AGENTS.md` provides navigation guidance - **Standardized Format**: Consistent headers and metadata enable better parsing - **Process Guidance**: Playbooks provide context for contribution workflows diff --git a/agentsDocResearch.md b/docs/research/logs/2025-12-25-agents-doc-research.md similarity index 100% rename from agentsDocResearch.md rename to docs/research/logs/2025-12-25-agents-doc-research.md diff --git a/toolEditResearch.md b/docs/research/logs/2025-12-25-change-scoped-file-editing.md similarity index 100% rename from toolEditResearch.md rename to docs/research/logs/2025-12-25-change-scoped-file-editing.md diff --git a/PR-190-Comprehensive-Assessment.md b/docs/research/pr-reports/PR-190-Comprehensive-Assessment.md similarity index 100% rename from PR-190-Comprehensive-Assessment.md rename to docs/research/pr-reports/PR-190-Comprehensive-Assessment.md diff --git a/justfile b/justfile index 20370f4e..d7360468 100644 --- a/justfile +++ b/justfile @@ -66,6 +66,14 @@ docs-validate base="origin/main" head="HEAD": setup-hooks: pre-commit install +# Ensure agent instruction mirrors are hardlinked to AGENTS.md +link-agents: + ./scripts/ensure_agent_hardlinks.sh + +# Install git hooks to keep agent hardlinks after checkout/merge +setup-hardlink-hooks: + ./scripts/install_git_hardlink_hooks.sh + # Skip Rust checks in pre-commit (useful for quick commits) commit-fast *args: SKIP_RUST_CHECKS=1 git commit {{args}} @@ -105,7 +113,7 @@ setup-sccache: echo "To enable: export RUSTC_WRAPPER=sccache" # Setup all development tools (run once after clone) -setup: setup-hooks setup-sccache +setup: setup-hooks setup-sccache setup-hardlink-hooks link-agents @echo "✓ Development environment ready" # Install Moonshine Python dependencies (transformers, torch, librosa via uv) diff --git a/mise.toml b/mise.toml index 886e9c09..ca02293a 100644 --- a/mise.toml +++ b/mise.toml @@ -33,6 +33,19 @@ description = "Universal Git Pre-commit Hook" # Avoids 'npx' to prevent registry lookup latency. run = "lint-staged" +[tasks.prepare] +description = "Repo bootstrap: hooks + agent hardlinks" +run = """ +#!/usr/bin/env bash +set -euo pipefail + +# Ensure pre-commit hooks are installed (idempotent). +pre-commit install + +# Enable repo-tracked git hooks and ensure AGENTS mirrors are hardlinked. +./scripts/install_git_hardlink_hooks.sh >/dev/null +""" + # --- TASK DELEGATION LAYER --- # lint-staged delegates logic here. diff --git a/scripts/ensure_agent_hardlinks.sh b/scripts/ensure_agent_hardlinks.sh new file mode 100755 index 00000000..49bfe1e2 --- /dev/null +++ b/scripts/ensure_agent_hardlinks.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$({ + cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd +})" + +src="$repo_root/AGENTS.md" + +dst1="$repo_root/.github/copilot-instructions.md" +dst2="$repo_root/.kilocode/rules/agents.md" + +if [[ ! -f "$src" ]]; then + echo "error: missing $src" >&2 + exit 1 +fi + +mkdir -p "$(dirname "$dst1")" "$(dirname "$dst2")" + +# Replace destination files with hard links to AGENTS.md. +# This is safe even if Git doesn't preserve hardlinks across clones: rerun anytime. +ln -f "$src" "$dst1" +ln -f "$src" "$dst2" + +# Show inode + link count for confirmation. +stat -c '%i %h %n' "$src" "$dst1" "$dst2" diff --git a/scripts/install_git_hardlink_hooks.sh b/scripts/install_git_hardlink_hooks.sh new file mode 100755 index 00000000..342d361a --- /dev/null +++ b/scripts/install_git_hardlink_hooks.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$({ + cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd +})" + +if [[ ! -d "$repo_root/.git" ]]; then + echo "error: not a git checkout (missing $repo_root/.git)" >&2 + exit 1 +fi + +hooks_path="$repo_root/.githooks" + +if [[ ! -d "$hooks_path" ]]; then + echo "error: missing $hooks_path (expected repo-tracked hooks)" >&2 + exit 1 +fi + +chmod +x "$hooks_path/post-checkout" "$hooks_path/post-merge" "$repo_root/scripts/ensure_agent_hardlinks.sh" + +git -C "$repo_root" config core.hooksPath .githooks + +echo "Enabled repo hooks via core.hooksPath=.githooks" +"$repo_root/scripts/ensure_agent_hardlinks.sh"