Backlog Manager

BacklogManager coordinates backlog files, task approvals, and resolution history for agent planning workflows.

Responsibilities

The BacklogManager module keeps a structured backlog on disk, supports updates to task descriptions and options, approves a task by writing a resolution, and moves completed work into history.

Backlog File Shape

Each backlog file contains tasks plus a history archive:

{
  "tasks": [
    {
      "description": "Write onboarding email",
      "options": ["Option A", "Option B"],
      "resolution": ""
    }
  ],
  "history": [
    {
      "description": "Draft release notes",
      "options": [],
      "resolution": "Published on the product blog."
    }
  ]
}

Public API

loadBacklog(filePath)

Loads the backlog file and returns tasks, history, and file metadata.

createBacklog(filePath)

Creates an empty backlog file on disk.

getTask(filePath, taskIndex)

Fetches a specific task by 1-based index.

addTask(filePath, initialContent)

Adds a new task with empty options and resolution.

addTasksFromText(filePath, text)

Splits a numbered list into multiple tasks.

addOptionsFromText(filePath, taskIndex, text)

Parses a numbered list and appends each option to a task.

approveTask(filePath, taskIndex, resolution)

Stores the chosen resolution and clears any pending options.

getApprovedTasks(filePath)

Returns tasks with a non-empty resolution.

getNewTasks(filePath)

Returns tasks that are in the backlog, including empty-resolution tasks.

updateTask(filePath, taskIndex, updates)

Applies partial updates to a task and normalises option/resolution values.

markDone(filePath, taskIndex)

Moves a task into history with a resolution fallback.

saveBacklog(filePath, data)

Saves a fully formed backlog payload to disk.

flush(filePath)

Forces a flush of the backlog file using the backing IO helper.

Usage Example

import {
  createBacklog,
  addTask,
  addOptionsFromText,
  approveTask,
  markDone
} from 'achillesAgentLib/BacklogManager';

await createBacklog('./docs_backlog.backlog');
const index = await addTask('./docs_backlog.backlog', 'Draft new onboarding guide');
await addOptionsFromText('./docs_backlog.backlog', index, '1) Publish this week\n2) Hold for review');
await approveTask('./docs_backlog.backlog', index, 'Publish this week');
await markDone('./docs_backlog.backlog', index);

Related Guides