- Create rules/{concerns,languages,frameworks}/ directory structure
- Add USAGE.md with flake.nix integration examples
- Add plan and notepad files for rules-system implementation
Refs: T1, T5 of rules-system plan
1.5 KiB
1.5 KiB
Opencode Rules Usage
Add AI coding rules to your project via mkOpencodeRules.
flake.nix Setup
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
m3ta-nixpkgs.url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
agents = {
url = "git+https://code.m3ta.dev/m3tam3re/AGENTS";
flake = false;
};
};
outputs = { self, nixpkgs, m3ta-nixpkgs, agents, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
m3taLib = m3ta-nixpkgs.lib.${system};
in {
devShells.${system}.default = let
rules = m3taLib.opencode-rules.mkOpencodeRules {
inherit agents;
languages = [ "python" "typescript" ];
frameworks = [ "n8n" ];
};
in pkgs.mkShell {
shellHook = rules.shellHook;
};
};
}
Parameters
agents(required): Path to AGENTS repo flake inputlanguages(optional): List of language names (e.g.,["python" "typescript"])concerns(optional): Rule categories (default: all standard concerns)frameworks(optional): List of framework names (e.g.,["n8n" "django"])extraInstructions(optional): Additional instruction file paths
.gitignore
Add to your project's .gitignore:
.opencode-rules
opencode.json
Project Overrides
Create AGENTS.md in your project root to override central rules. OpenCode applies project-level rules with precedence over central ones.
Updating Rules
When central rules are updated:
nix flake update agents