agency-rules 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0](https://github.com/deuriib/agency-rules/compare/v0.5.0...v0.6.0) (2026-10-31)
9
+
10
+
11
+ ### Features
12
+
13
+ * **rules:** add Agentmemory MCP guidelines ([0d68b32](https://github.com/deuriib/agency-rules/commit/0d68b32e91b5385087b34d9dc93b45576bf88ceb))
14
+ * **rules:** add Agentmemory MCP guidelines ([1c846f5](https://github.com/deuriib/agency-rules/commit/1c846f5715137ea0d98d5365b99e4589a129a92b)), closes [#14](https://github.com/deuriib/agency-rules/issues/14)
15
+ * **rules:** add subagent delegation guidelines ([4527e1f](https://github.com/deuriib/agency-rules/commit/4527e1f7a16fb131a09406083562d59ff9f0eb8b))
16
+ * **rules:** add subagent delegation guidelines ([1042370](https://github.com/deuriib/agency-rules/commit/1042370beb15a15e9f9a57831a754da4ee05edbc)), closes [#15](https://github.com/deuriib/agency-rules/issues/15)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * unused variable via biome ([7bd25b1](https://github.com/deuriib/agency-rules/commit/7bd25b1c8c1b28521d6aaee57e1d5179e0cfafab))
22
+
23
+ ## [0.5.0](https://github.com/deuriib/agency-rules/compare/v0.4.1...v0.5.0) (2026-10-31)
24
+
25
+
26
+ ### Features
27
+
28
+ * **cli:** add 'list' command to display available rules ([15a7302](https://github.com/deuriib/agency-rules/commit/15a73025cd8ae1f90ab4a8602ac68817306aa128))
29
+
8
30
  ## [0.4.1](https://github.com/deuriib/agency-rules/compare/v0.4.0...v0.4.1) (2026-10-31)
9
31
 
10
32
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `agency-rules` compiles a single set of generic Markdown rules into the
6
6
  native formats expected by **Google Antigravity**, **pi-agent**,
7
- **oh-my-pi (omp)**, and **OpenCode** (via the `opencode-rules` plugin).
7
+ **oh-my-pi (omp)**, and **OpenCode** (via the [opencode-rules]("https://github.com/frap129/opencode-rules") plugin).
8
8
 
9
9
  The whole pipeline — toolchain, environment, and tasks — is managed by
10
10
  [mise](https://mise.jdx.dev), so every collaborator and CI runner uses the
@@ -21,7 +21,7 @@ Every coding agent has its own rule format:
21
21
  | Google Antigravity | YAML frontmatter with `trigger` | `.agents/rules/*.md` |
22
22
  | pi-agent | Per-rule directory with `RULES.md` | `.pi/rules/<slug>/RULES.md` |
23
23
  | oh-my-pi (omp) | Markdown with frontmatter | `.omp/rules/*.{md,mdc}` |
24
- | OpenCode | Markdown via `opencode-rules` plugin | `.opencode/rules/*.md` |
24
+ | OpenCode | Markdown via [opencode-rules]("https://github.com/frap129/opencode-rules") plugin | `.opencode/rules/*.md` |
25
25
 
26
26
  Writing the same rule four times is a maintenance nightmare. `agency-rules`
27
27
  lets you write it **once** in a neutral format and compile it to all four
@@ -29,17 +29,18 @@ Write rules once. Run them in every harness.
29
29
  $ agency-rules <command> [options]
30
30
 
31
31
  \x1b[33mCommands:\x1b[0m
32
- \x1b[32mconvert\x1b[0m Compile rules/ into each harness's native format
33
- \x1b[32minstall\x1b[0m Install compiled artifacts into detected harnesses
34
- \x1b[32mvalidate\x1b[0m Validate each rule's frontmatter against the schema
32
+ \x1b[32mlist\x1b[0m List all available rules
33
+ \x1b[32mconvert\x1b[0m Compile rules/ into each harness's native format
34
+ \x1b[32minstall\x1b[0m Install compiled artifacts into detected harnesses
35
+ \x1b[32mvalidate\x1b[0m Validate each rule's frontmatter against the schema
35
36
 
36
37
  \x1b[33mGlobal Options:\x1b[0m
37
38
  -h, --help Show this help message
38
39
  -v, --version Show version number
39
40
 
40
41
  \x1b[33mExamples:\x1b[0m
42
+ $ agency-rules list
41
43
  $ agency-rules validate
42
- $ agency-rules convert
43
44
  $ agency-rules convert --dry-run
44
45
  $ agency-rules install --scope user --harness opencode
45
46
  `);
@@ -47,6 +48,17 @@ Write rules once. Run them in every harness.
47
48
 
48
49
  const showCommandHelp = (cmd) => {
49
50
  const helps = {
51
+ list: `
52
+ \x1b[36magency-rules list\x1b[0m
53
+ List all available rules and their descriptions.
54
+
55
+ \x1b[33mOptions:\x1b[0m
56
+ --json Output the list in JSON format (useful for scripting)
57
+
58
+ \x1b[33mExamples:\x1b[0m
59
+ $ agency-rules list
60
+ $ agency-rules list --json | jq '.'
61
+ `,
50
62
  convert: `
51
63
  \x1b[36magency-rules convert\x1b[0m
52
64
  Compile rules/ into each harness's native format.
@@ -101,7 +113,7 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
101
113
  process.exit(0);
102
114
  }
103
115
 
104
- if (!['convert', 'install', 'validate'].includes(command)) {
116
+ if (!['list', 'convert', 'install', 'validate'].includes(command)) {
105
117
  console.error(`\x1b[31mError:\x1b[0m Unknown command '${command}'`);
106
118
  showHelp();
107
119
  process.exit(1);
@@ -114,7 +126,6 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
114
126
  }
115
127
 
116
128
  // ── Execute ───────────────────────────────────────────────────────────
117
- // Remove the command from argv so the downstream script's parseArgs works cleanly
118
129
  process.argv.splice(2, 1);
119
130
 
120
131
  const scriptPath = resolve(import.meta.dirname, '..', 'scripts', `${command}.mjs`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-rules",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "Write rules once. Run them in every harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: agentmemory
3
+ description: Guidelines and strict rules for interacting with the Agentmemory MCP server.
4
+ alwaysApply: true
5
+ tags: [mcp, memory, context]
6
+ ---
7
+
8
+ # Agentmemory MCP Rules
9
+
10
+ - **MEM-01** — Recall Before Asking. At the START of any task, call `memory_recall` (or `memory_smart_search`) with the task context before asking the user to repeat anything.
11
+ - **MEM-02** — Save at Decision Points. When you learn something durable (a decision, a fix, a gotcha, a user preference, a project convention), call `memory_save` in the same session — do not batch it for later.
12
+ - **MEM-03** — Lessons From Corrections. Signals this applies: explicit "always/never", "learn this", "from now on", a repeated user fix to the same behavior, "I told you before". Call `memory_save` with a confidence score; re-saving duplicate content strengthens the existing lesson instead of forking it. Before similar work, call `memory_lesson_recall` — check what was learned before deciding. One concept per lesson; state when and where it applies via context and tags.
13
+ - **MEM-04** — Resume, Don't Restart. Resume / recap / "where were we" → `memory_sessions` plus `memory_timeline` around the anchor before doing anything else. Lead with any unanswered question from the prior session. Use `memory_timeline` for chronological context and `memory_smart_search` with `expandIds` for detail — never re-derive what history already holds.
14
+ - **MEM-05** — Track Multi-Step Work as Actions. Work with 3+ steps → `memory_action_create` with typed dependencies; pull from `memory_frontier` / `memory_next`, not vibes. Memory lease acquire before starting an action; release or renew explicitly — leases prevent double-work across agents. Update status in real time; resolving to done unblocks dependents. Hand off via `memory_signal_send`, pick up via `memory_signal_read`.
15
+ - **MEM-06** — Slots Are Small, Pinned State. Durable user or project state (persona, pending items) → memory slots: `memory_slot_get` / `memory_slot_list` first, then `memory_slot_replace`. Appends fail past `sizeLimit` — compact via replace first, never loop blind appends. Seeded defaults are starting values, not gospel; replace them when the user corrects them.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: subagent-delegation
3
+ description: Guidelines for delegating tasks to subagents using spawn, dispatch, or invoke.
4
+ trigger: model_decision
5
+ tags: [workflow, subagents, context-management]
6
+ ---
7
+
8
+ # Subagent Delegation Rules
9
+
10
+ - **SUB-01** — Trigger Words. When the user says `spawn`, `dispatch`, or `invoke`, they are explicitly asking you to delegate the task to a subagent. Do not attempt to execute the task in the main thread.
11
+ - **SUB-02** — When to Delegate. Use subagents for:
12
+ - **Context-heavy tasks:** Searching large codebases, reading multiple files, or exploring documentation.
13
+ - **Parallelizable work:** Multiple independent fixes or searches that can happen concurrently.
14
+ - **Specialized tasks:** Writing tests, refactoring specific modules, or applying strict formatting.
15
+ - **SUB-03** — Clear Prompts. When spawning a subagent, provide a self-contained prompt. Do not assume the subagent has access to the current conversation history. Pass all necessary context, file paths, and constraints explicitly.
16
+ - **SUB-04** — Await and Synthesize. Wait for the subagent to complete and return its result. Verify the output and synthesize it back into the main workflow before presenting the final answer to the user.
17
+ - **SUB-05** — Fail Safely. If a subagent fails or hits a limit, do not silently retry in the main thread. Report the failure, analyze the error, and decide whether to retry the subagent with a better prompt or escalate to the user.
@@ -1,4 +1,4 @@
1
- import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
1
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join, resolve } from 'node:path';
3
3
  import { parseArgs } from 'node:util';
4
4
  import { readRules } from './lib/frontmatter.mjs';
@@ -0,0 +1,48 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { parseArgs } from 'node:util';
4
+ import { readRules } from './lib/frontmatter.mjs';
5
+
6
+ const { values: args } = parseArgs({
7
+ options: {
8
+ json: { type: 'boolean', default: false },
9
+ },
10
+ });
11
+
12
+ // Resolve paths (local vs package fallback)
13
+ const PACKAGE_ROOT = resolve(import.meta.dirname, '..');
14
+ const localRules = resolve(process.cwd(), 'rules');
15
+ const RULES_DIR =
16
+ process.env.RULES_DIR || (existsSync(localRules) ? localRules : resolve(PACKAGE_ROOT, 'rules'));
17
+
18
+ const rules = await readRules(RULES_DIR);
19
+
20
+ if (rules.length === 0) {
21
+ console.error(`❌ No rules found in ${RULES_DIR}`);
22
+ process.exit(1);
23
+ }
24
+
25
+ // ── JSON Output ───────────────────────────────────────────────────────
26
+ if (args.json) {
27
+ const output = rules.map((r) => ({
28
+ name: r.slug,
29
+ description: r.data.description || 'No description provided',
30
+ source: r.source,
31
+ }));
32
+ console.log(JSON.stringify(output, null, 2));
33
+ process.exit(0);
34
+ }
35
+
36
+ // ── Pretty Terminal Output ────────────────────────────────────────────
37
+ // Find the longest name to align the columns perfectly
38
+ const maxSlugLength = Math.max(...rules.map((r) => r.slug.length));
39
+
40
+ console.log(`\n📚 \x1b[1mAvailable Rules\x1b[0m (${rules.length})\n`);
41
+
42
+ for (const rule of rules) {
43
+ const paddedSlug = rule.slug.padEnd(maxSlugLength);
44
+ // Using Cyan for the rule name
45
+ console.log(` \x1b[36m${paddedSlug}\x1b[0m ${rule.data.description || 'No description'}`);
46
+ }
47
+
48
+ console.log('\n');