Skip to content

Add hierarchical AGENTS.md knowledge base for AI-assisted development#320

Open
vboufleur wants to merge 2 commits into
BarutSRB:mainfrom
vboufleur:add-agents-md
Open

Add hierarchical AGENTS.md knowledge base for AI-assisted development#320
vboufleur wants to merge 2 commits into
BarutSRB:mainfrom
vboufleur:add-agents-md

Conversation

@vboufleur
Copy link
Copy Markdown

@vboufleur vboufleur commented May 14, 2026

Hi!

This is a simple PR for adding docs for agents to better work on it. It was generated using the /init-deep cmd of oh-my-openagent on Claude Opus 4.6

Feel free to add changes to the files. I'm not that experience with the app but I plan to later add a feature for scrolling all windows horizontally as soon as a window is selected with the mouse and is moved, trying to make the experience as similar as possible to my favorite WM, PaperWM on Gnome. These files can help to implement it, and can be useful to the community as well.

Here's the summary by Copilot:

This pull request adds detailed architecture and development documentation for the OmniWM project and its major subsystems. The new `AGENTS.md` files provide comprehensive overviews of project structure, architectural patterns, code conventions, and extension guidelines for the main app, core modules, layout engines, IPC protocol, reconciliation engine, controller layer, and test suite.

Key documentation additions and improvements:

**Project-wide and Core Architecture:**
- Added `AGENTS.md` at the project root, describing OmniWM's identity, event-driven architecture, build and verification processes, code style, concurrency model, IPC protocol, and testing approach.
- Added `AGENTS.md` for `Sources/OmniWM/Core`, detailing core module responsibilities, architectural layering, subdirectory map, key design patterns (e.g., @MainActor usage, pure layout engines, event normalization), and guidance for adding new features.

**Subsystem and Engine Documentation:**
- Added `AGENTS.md` for `Sources/OmniWM/Core/Controller`, outlining the event routing and orchestration layer, file map, handler patterns, layout refresh pipeline, and steps for extending with new handlers.
- Added `AGENTS.md` for `Sources/OmniWM/Core/Layout/Niri`, explaining the Niri layout engine's state machine nature, file organization, abstractions, conventions, and extension process.
- Added `AGENTS.md` for `Sources/OmniWM/Core/Reconcile`, documenting the deterministic reconciliation engine, event pipeline, planning/reduction flow, invariants, and steps for introducing new events.

**IPC and Testing:**
- Added `AGENTS.md` for `Sources/OmniWMIPC`, specifying the IPC protocol, file map, conventions, and extension process for commands and queries.
- Added `AGENTS.md` for `Tests/OmniWMTests`, describing test framework conventions, support infrastructure, fixtures, and best practices for writing new tests.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive developer guides across core modules describing architecture, event-driven reconciliation, layout engine rules, controller/handler patterns, and IPC protocol conventions.
    • Documented coding/style rules, strict concurrency expectations, build/test workflows, and testing conventions.
    • Included contribution checklists for adding features, handlers, layout operations, IPC commands, and tests.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

Adds seven new AGENTS.md documentation files that codify OmniWM architecture, module responsibilities, IPC protocol, tooling and style rules, strict Swift concurrency expectations, dependency-injection/testing guidance, and contributor checklists.

Changes

OmniWM Architectural Documentation (docs-only)

Layer / File(s) Summary
Root project conventions and constraints
AGENTS.md
Project-wide engineering guide: SwiftPM targets, pinned SwiftFormat/SwiftLint versions, build/lint/test/verify commands, ghostty/zig preflight notes, naming/formatting rules, numeric limits, strict Swift 6 concurrency expectations (@MainActor, IPC actors, Sendable, ThreadGuardedValue, strict concurrency mode), layout/persistence constraints, and DI guidance for WMController.
Core module architecture and subsystems
Sources/OmniWM/Core/AGENTS.md, Sources/OmniWM/Core/Controller/AGENTS.md, Sources/OmniWM/Core/Reconcile/AGENTS.md, Sources/OmniWM/Core/Layout/Niri/AGENTS.md
Per-submodule guides: end-to-end event→plan→reduce→layout→output pipeline; controller routing/handler patterns, layout refresh/focus bridge, reconcile invariants (pure reducer, immutable events, snapshots, auditing), and Niri layout engine contract (pure state machine, indices/coords/rounding) plus contributor checklists and wiring guidance.
IPC protocol documentation
Sources/OmniWMIPC/AGENTS.md
OmniWMIPC contributor guide: transport (Unix socket), NDJSON wire format, size/version/auth/token rules, socket path override, module file map, and steps to add commands/queries with versioning and router updates.
Testing conventions and support infrastructure
Tests/OmniWMTests/AGENTS.md
Test-agent guide: Apple Testing framework usage (no XCTest), example @Suite @MainActor`` tests, #expect/Issue.record conventions, per-test `UserDefaults` isolation, shared-state reset helpers, synthetic display IDs, available test factories/fixtures (`canonical-settings.toml`), required test imports, and checklist for authoring tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 ✨
Docstrings bloom in every fold,
Architecture tales retold,
From root to tests, the story flows,
Where OmniWM's structure grows!
- The Reviewer Bunny

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changeset: adding hierarchical AGENTS.md documentation files across the repository. It is concise, clear, and directly reflects the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
Sources/OmniWMIPC/AGENTS.md (1)

46-51: ⚡ Quick win

Consider adding protocol version guidance for queries.

The "Adding New Commands" section explicitly mentions bumping the protocol version for breaking changes (line 44), but this section omits similar guidance. Query changes can also break compatibility. Based on learnings, protocol version should be bumped for any breaking IPC changes.

📋 Suggested addition
 ## Adding New Queries
 
 1. Add case to `IPCQueryName` enum
 2. Define response payload struct (must be `Codable, Equatable, Sendable`)
 3. Add descriptor to automation manifest
 4. Handle in `IPCQueryRouter`
+5. Bump protocol version if breaking change
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Sources/OmniWMIPC/AGENTS.md` around lines 46 - 51, Add guidance to the
"Adding New Queries" section to remind contributors to bump the IPC protocol
version for any breaking changes: explicitly state that when modifying
IPCQueryName, changing the response payload struct signature (types/properties),
altering the automation manifest descriptor, or changing how IPCQueryRouter
handles queries in a way that is not backward compatible, the protocol version
must be incremented (matching the "Adding New Commands" guidance). Mention
whether major/minor/patch semantics are used and where to update the protocol
version constant so authors know the exact place to change it.
Tests/OmniWMTests/AGENTS.md (1)

65-72: ⚡ Quick win

Add verification step to testing workflow.

The checklist should remind developers to run the verification suite. Based on learnings, developers should run make verify (which includes format-check, lint, no-zig-audit, build, and test) before committing changes.

📋 Suggested addition
 ## Writing New Tests
 
 1. Create `{Feature}Tests.swift`
 2. Use `@Suite `@MainActor` struct`
 3. Use factory functions from support files for state setup
 4. Call `resetSharedControllerStateForTests()` if touching global state
 5. Prefer `#expect()` over complex assertion helpers
 6. For layout tests, use `makeLayoutPlanTestController` + `waitForLayoutPlanRefreshWork()`
+7. Run `make verify` before committing (includes format-check, lint, build, and test)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/OmniWMTests/AGENTS.md` around lines 65 - 72, Add a final verification
step to the test-writing checklist: append a new numbered item after step 6 that
instructs developers to run the full verification suite using the shell command
`make verify` (this runs format-check, lint, no-zig-audit, build, and test).
Edit the AGENTS.md checklist where the numbered items (1–6) are listed and add
the new step text recommending `make verify` before committing, ensuring it
references the command exactly as `make verify`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 11-13: The fenced code block containing the architecture line
starting with "Input (Hotkeys, AX, Mouse, CGS) → WMEvent → Reconcile ..." has no
language tag and triggers markdownlint MD040; fix it by adding a language
identifier (e.g., "text") immediately after the opening ``` so the block becomes
```text ... ```, ensuring the markdown linter recognizes the fenced block
language.

In `@Sources/OmniWM/Core/AGENTS.md`:
- Around line 9-21: The markdown code fence for the pipeline diagram lacks a
language identifier which triggers markdownlint MD040; update the opening fence
from ``` to include a language (e.g., ```text) so the block is annotated —
modify the fenced block that contains the pipeline diagram (the Input Layer →
Output Layer diagram in AGENTS.md) to use a language identifier such as "text".

In `@Sources/OmniWM/Core/Controller/AGENTS.md`:
- Around line 50-52: The guide uses inconsistent coordinator names—replace all
occurrences of FocusBridgeCoordinator and KeyboardFocusLifecycleCoordinator with
the unified name FocusLifecycleCoordinator and update the prose to describe the
deferred focus pending → confirmed pattern handled by FocusLifecycleCoordinator;
ensure the header "Focus Bridge (Deferred Focus)" and any explanatory lines
reference FocusLifecycleCoordinator and the "pending → confirmed" flow so the
guide consistently maps the focus lifecycle to FocusLifecycleCoordinator.

In `@Sources/OmniWM/Core/Reconcile/AGENTS.md`:
- Around line 41-55: The fenced code block in AGENTS.md (the block starting with
``` and the event flow lines like "Raw Event (AX/CGS/Input)" through
"ReconcileTxn recorded for audit") lacks a language identifier and triggers
markdownlint MD040; add a language token (e.g., "text") after the opening
backticks so the fence becomes ```text to silence MD040 and preserve rendering.

In `@Sources/OmniWMIPC/AGENTS.md`:
- Around line 16-22: Update the File Map in AGENTS.md to list the two missing
support files so the total equals six; locate the section that currently lists
IPCModels.swift, IPCAutomationManifest.swift, IPCWire.swift, and
IPCSocketPath.swift and add the two omitted filenames (the small helper/support
files present in the module, e.g., the actual support files that correspond to
socket/message helpers—replace this placeholder with the real filenames found in
the repo) so the document accurately enumerates all six files and their brief
descriptions.

---

Nitpick comments:
In `@Sources/OmniWMIPC/AGENTS.md`:
- Around line 46-51: Add guidance to the "Adding New Queries" section to remind
contributors to bump the IPC protocol version for any breaking changes:
explicitly state that when modifying IPCQueryName, changing the response payload
struct signature (types/properties), altering the automation manifest
descriptor, or changing how IPCQueryRouter handles queries in a way that is not
backward compatible, the protocol version must be incremented (matching the
"Adding New Commands" guidance). Mention whether major/minor/patch semantics are
used and where to update the protocol version constant so authors know the exact
place to change it.

In `@Tests/OmniWMTests/AGENTS.md`:
- Around line 65-72: Add a final verification step to the test-writing
checklist: append a new numbered item after step 6 that instructs developers to
run the full verification suite using the shell command `make verify` (this runs
format-check, lint, no-zig-audit, build, and test). Edit the AGENTS.md checklist
where the numbered items (1–6) are listed and add the new step text recommending
`make verify` before committing, ensuring it references the command exactly as
`make verify`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09d083bd-a322-4a2c-b21e-a1a3b0ec7901

📥 Commits

Reviewing files that changed from the base of the PR and between a45bd3b and 248bf42.

📒 Files selected for processing (7)
  • AGENTS.md
  • Sources/OmniWM/Core/AGENTS.md
  • Sources/OmniWM/Core/Controller/AGENTS.md
  • Sources/OmniWM/Core/Layout/Niri/AGENTS.md
  • Sources/OmniWM/Core/Reconcile/AGENTS.md
  • Sources/OmniWMIPC/AGENTS.md
  • Tests/OmniWMTests/AGENTS.md

Comment thread AGENTS.md Outdated
Comment thread Sources/OmniWM/Core/AGENTS.md Outdated
Comment thread Sources/OmniWM/Core/Controller/AGENTS.md
Comment thread Sources/OmniWM/Core/Reconcile/AGENTS.md Outdated
Comment thread Sources/OmniWMIPC/AGENTS.md Outdated
- Add 'text' language identifier to fenced code blocks (MD040)
- Fix inconsistent coordinator name: FocusBridgeCoordinator → KeyboardFocusLifecycleCoordinator
- Complete IPC file map with IPCRuleValidator.swift and WorkspaceAddressing.swift
@BarutSRB
Copy link
Copy Markdown
Owner

@vboufleur Hi thank you ❤️ I'll take a look at this on the next free day, the only problem O have with agents.md is how much context they use and if too strict can actually be counter productive and change your intent, my current one is only 4 lines, do not write code comments, do not create new branches or push commits, do not alter tests or production code if a test fails just notify the users, and I forgot the 4th one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants