baton-issue-tracker 1.14.0 → 1.14.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baton-issue-tracker",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "A CLI issue tracker for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,8 @@
12
12
  // baton init --specs C:\full\path\to\specs.md
13
13
 
14
14
  import { readFileSync, writeFileSync, existsSync } from 'node:fs';
15
- import { join } from 'node:path';
15
+ import { join, dirname } from 'node:path';
16
+ import { fileURLToPath } from 'node:url';
16
17
  import { initDB } from '../db/index.js';
17
18
  import os from 'node:os';
18
19
  import { registerAgent } from '../services/agentsService.js';
@@ -174,7 +175,7 @@ export async function run(args = []) {
174
175
  console.log(autoRegisterMessage);
175
176
  }
176
177
 
177
- const templatePath = join('docs', 'BATON_AGENT_RULES.md');
178
+ const templatePath = join(dirname(fileURLToPath(import.meta.url)), '..', 'templates', 'BATON_AGENT_RULES.md');
178
179
 
179
180
  let rulesContent = '';
180
181
  if (existsSync(templatePath)) {
@@ -182,13 +183,10 @@ export async function run(args = []) {
182
183
  }
183
184
 
184
185
  const outputPath = join(process.cwd(), 'BATON_AGENT_RULES.md');
185
- if (existsSync(outputPath) && !flags.force) {
186
- console.error('Error: BATON_AGENT_RULES.md already exists. Use --force to overwrite.');
187
- return 1;
186
+ if (!existsSync(outputPath) || flags.force) {
187
+ writeFileSync(outputPath, rulesContent, 'utf8');
188
188
  }
189
189
 
190
- writeFileSync(outputPath, rulesContent, 'utf8');
191
-
192
190
  const resolvedSpecsPath = resolvePath(flags.specs, DEFAULT_SPECS_PATH);
193
191
  const createdIssues = generateIssuesFromSpecs(flags.specs);
194
192
  const envelope = {
@@ -0,0 +1,47 @@
1
+ # Baton Agent Rules & System Instructions
2
+
3
+ This document defines the strict operational boundaries and workflows for all AI agents working within this repository.
4
+
5
+ ## 1. Single Source of Truth
6
+ **Baton is the absolute single source of truth for all tasks, issues, and progress.**
7
+ * **BANNED:** Do not use markdown TODO lists, scratchpad memory files, inline comments for tracking, or any other alternative task management methods.
8
+ * All state, priority, and assignment must be read from and written to the Baton CLI.
9
+
10
+ ## 2. Allowed Commands
11
+ Agents must interface with Baton using the following commands. **You MUST use the `--json` flag** on all commands to ensure machine-readable output.
12
+
13
+ | Action | Command | Purpose |
14
+ | :--- | :--- | :--- |
15
+ | **Check Identity** | `baton whoami --json` | Verify if you are registered and authorized to work. |
16
+ | **Register Self** | `baton register --name <name> --type agent --json` | Register yourself if `whoami` returns an error or is not found. |
17
+ | **Check Status** | `baton status --json` | View overall progress and issue counts. |
18
+ | **List Issues** | `baton list --status open --json` | View available work (can filter by status/priority). |
19
+ | **Search Issues** | `baton search "<query>" --json` | Search for existing issues to avoid creating duplicates. |
20
+ | **View Issue** | `baton view <id> --json` | Read the full details and requirements of a specific ticket. |
21
+ | **Claim Next Issue** | `baton claim --json` | Automatically claim the highest-priority open issue and mark it `In-Progress`. |
22
+ | **Submit for Review** | `baton submit <id> --json` | Mark a completed task as ready for human approval. |
23
+ | **Unclaim Issue** | `baton unclaim <id> --json` | Relinquish a task if you are stuck or hit the loop limit. |
24
+ | **Update Issue** | `baton update <id> [options] --json` | Update specific fields (e.g., `--description`) if required. |
25
+ | **Create Issue** | `baton create --title "<text>" --json` | Generate a new ticket (e.g., for reporting a bug). |
26
+ | **View History** | `baton log <id> --json` | Check previous attempts, rejections, or actions on a ticket. |
27
+
28
+ *Note: Commands like `init`, `loop`, `approve`, `reject`, `priority`, and `delete` are strictly reserved for human supervisors or system orchestration.*
29
+
30
+ ## 3. Standard Workflow
31
+ You must strictly adhere to this step-by-step lifecycle for every task:
32
+
33
+ 1. **Authenticate:** Run `baton whoami --json`. If you are not registered, run `baton register --name <your_name> --type agent --json` before proceeding.
34
+ 2. **Orient:** Run `baton status --json` to understand the current project state.
35
+ 3. **Find Work:** Run `baton list --status open --json` or `baton search --json` to review available issues.
36
+ 4. **Claim:** Run `baton claim --json` to automatically assign yourself the highest-priority task. Note the `id` returned.
37
+ 5. **Research & Execute:** Read the issue details (`baton view <id> --json`). Perform the necessary research, code changes, and testing to fulfill the requirements.
38
+ 6. **Submit for Review:** Once the work is complete and verified locally, run `baton submit <id> --json`. Wait for human approval or rejection.
39
+
40
+ ## 4. Loop Mitigation (The Three-Strike Rule)
41
+ To prevent infinite loops and wasted tokens, you must obey the **Three-Strike Rule**:
42
+
43
+ * If you attempt a task and fail to resolve it **three consecutive times** (e.g., your tests keep failing, or the human rejects your work three times for the same reason), you MUST:
44
+ 1. Halt execution on the task.
45
+ 2. **Unclaim the issue:** Run `baton unclaim <id> --json` to move it back to `Open`.
46
+ 3. Prepend the issue description with a clear explanation of the failure using `baton update <id> --description "FAILED 3 TIMES: [Your brief explanation] \n\n [Original Description]"`.
47
+ 4. Stop and prompt the human supervisor for intervention and guidance.