Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions pm-workflow-pack/00-scan-scope-and-method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# PM Workflow Pack: Scan Scope and Method

## Scope

This pack was produced from repo-local evidence in `/Users/hue/code/task-orchestrator` only.
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The scan scope is anchored to a machine-specific absolute path (/Users/hue/...). This makes the pack less portable and can leak local username details. Consider rewriting this to “run from the repo root” (or a placeholder like <repo-root>) and keep commands/citations repo-relative.

Suggested change
This pack was produced from repo-local evidence in `/Users/hue/code/task-orchestrator` only.
This pack was produced from repo-local evidence in this repository (from the repo root) only.

Copilot uses AI. Check for mistakes.

Primary directories searched:
- `current/src/main/kotlin`
- `current/src/main/resources`
- `current/src/test/kotlin`
- `current/docs`
- `clockwork/src/main/kotlin`
- `clockwork/src/test/kotlin`
- `clockwork/docs`
- `claude-plugins/task-orchestrator`
- `.claude-plugin`
- `scripts`
- `.github`

Primary runtime/config selectors inspected:
- `settings.gradle.kts`
- `build.gradle.kts`
- `docker-compose.yml`
- `Dockerfile`
- `scripts/docker-build.sh`
- `CLAUDE.md`
- `AGENTS.md`
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

This pack cites AGENTS.md as an inspected selector, but AGENTS.md is not present in the repository tree in this PR. Either add the file to the repo, or remove/replace the references so readers can audit the cited lines.

Suggested change
- `AGENTS.md`

Copilot uses AI. Check for mistakes.

## Commands Used

Representative inspection commands:

```bash
git branch --show-current
git rev-parse HEAD
git status --short

rg --files current/src/main/kotlin current/src/main/resources current/src/test/kotlin \
clockwork/src/main/kotlin clockwork/src/test/kotlin \
claude-plugins/task-orchestrator .claude-plugin scripts .github

nl -ba settings.gradle.kts | sed -n '1,40p'
nl -ba build.gradle.kts | sed -n '1,40p'
nl -ba docker-compose.yml | sed -n '1,140p'
nl -ba Dockerfile | sed -n '1,160p'
nl -ba scripts/docker-build.sh | sed -n '1,140p'

nl -ba current/src/main/kotlin/.../CurrentMain.kt | sed -n '9,46p'
nl -ba current/src/main/kotlin/.../CurrentMcpServer.kt | sed -n '38,223p'
nl -ba current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql | sed -n '1,140p'
nl -ba current/src/main/resources/db/migration/V2__Work_Item_Field_Updates.sql | sed -n '1,140p'
Comment on lines +48 to +51
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The “Representative inspection commands” block uses ... placeholders in paths (e.g., current/src/main/kotlin/.../CurrentMain.kt), which makes the commands non-reproducible if copy/pasted. Consider replacing these with the concrete paths used elsewhere in the pack (or explicitly label them as placeholders and point to the exact files).

Copilot uses AI. Check for mistakes.

nl -ba current/src/main/kotlin/.../RoleTransitionHandler.kt | sed -n '74,370p'
nl -ba current/src/main/kotlin/.../AdvanceItemTool.kt | sed -n '120,387p'
nl -ba current/src/main/kotlin/.../GetNextItemTool.kt | sed -n '77,225p'
nl -ba current/src/main/kotlin/.../GetBlockedItemsTool.kt | sed -n '101,310p'
nl -ba current/src/main/kotlin/.../GetNextStatusTool.kt | sed -n '60,141p'
nl -ba current/src/main/kotlin/.../GetContextTool.kt | sed -n '106,400p'
nl -ba current/src/main/kotlin/.../ManageItemsTool.kt | sed -n '163,520p'
nl -ba current/src/main/kotlin/.../ManageNotesTool.kt | sed -n '128,280p'
nl -ba current/src/main/kotlin/.../ManageDependenciesTool.kt | sed -n '241,340p'
nl -ba current/src/main/kotlin/.../CompleteTreeTool.kt | sed -n '160,340p'
nl -ba current/src/main/kotlin/.../CreateWorkTreeTool.kt | sed -n '13,307p'
nl -ba current/src/main/kotlin/.../SQLiteWorkTreeService.kt | sed -n '23,166p'

nl -ba clockwork/DEPRECATED.md | sed -n '1,140p'
nl -ba clockwork/src/main/kotlin/Main.kt | sed -n '1,102p'
nl -ba clockwork/src/main/kotlin/.../McpServer.kt | sed -n '108,319p'
nl -ba clockwork/src/main/kotlin/.../RequestTransitionTool.kt | sed -n '21,160p'
nl -ba clockwork/src/main/kotlin/.../QueryRoleTransitionsTool.kt | sed -n '14,140p'
```

Negative-evidence searches are recorded in `99-evidence-index.md`.

## Search Terms

Targeted search terms included:
- `role`, `status`, `transition`, `advance_item`, `request_transition`
- `blocked`, `dependency`, `unblockAt`, `get_next_item`, `get_blocked_items`
- `note`, `schema`, `guidancePointer`, `get_context`
- `decision`, `progress`, `comment`, `chronicle`, `timeline`, `event store`
- `CurrentMcpServer`, `CurrentMain`, `clockwork`, `runtime-v2`, `runtime-current`
- `AGENT_CONFIG_DIR`, `.taskorchestrator/config.yaml`, `default-config.yaml`

## Files and Types Inspected

File types inspected:
- Kotlin runtime code (`.kt`)
- SQL migrations (`.sql`)
- Markdown docs and runbooks (`.md`)
- JSON plugin/hook config (`.json`)
- Shell scripts (`.sh`)
- GitHub workflow YAML (`.yml`)

Priority order during inspection:
1. Runtime/build selectors
2. Active module code under `current/`
3. Database schema and repositories
4. Tests covering workflow behavior
5. Archived `clockwork/` code for variant analysis
6. Plugin/hook/config docs for exposed seams

## Runtime / Config Selectors Examined

Selectors used to determine active vs archived paths:
- `settings.gradle.kts:6-10`
- `build.gradle.kts:1-3`
- `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/CurrentMain.kt:10-12`
- `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/interfaces/mcp/CurrentMcpServer.kt:41-45`
- `clockwork/DEPRECATED.md:3-5,73`
- `docker-compose.yml:2-24,36-102`
- `Dockerfile:31-33,82-92`
- `scripts/docker-build.sh:5-13,57-68`

## Limitations

- The active/current implementation was inspected statically; no server process was started.
- Targeted Gradle tests were attempted but not executed successfully:

```bash
./gradlew :current:test --tests "*RoleTransitionHandlerTest" --tests "*SchemaGatedLifecycleTest" \
--tests "*GetNextItemToolTest" --tests "*GetBlockedItemsToolTest" --tests "*GetContextToolTest"
```

Observed failure:
- `./gradlew` was not executable in this environment.

Retry:

```bash
bash ./gradlew :current:test --tests "*RoleTransitionHandlerTest" --tests "*SchemaGatedLifecycleTest" \
--tests "*GetNextItemToolTest" --tests "*GetBlockedItemsToolTest" --tests "*GetContextToolTest"
```

Observed failure:
- no Java runtime was installed (`Unable to locate a Java Runtime.`)

- `AGENTS.md` is untracked in this checkout, but it was still repo-local and inspected as local guidance, not as higher authority than code.
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

This limitation note references AGENTS.md being “untracked in this checkout”, but the file is not present in the repo, so readers cannot verify any later citations to it. Suggest removing this line (and any AGENTS.md citations), or committing AGENTS.md if it is intended to be part of the evidence set.

Suggested change
- `AGENTS.md` is untracked in this checkout, but it was still repo-local and inspected as local guidance, not as higher authority than code.

Copilot uses AI. Check for mistakes.

## Negative-Evidence Method

Negative claims in this pack use this method:
- define a bounded scan scope
- run explicit `rg` queries against that scope
- record exact commands and results in `99-evidence-index.md`
- label the result as `absent/no evidence found`, not as impossibility

Where code and docs disagree, code/build/runtime selectors were treated as higher authority than prose.
65 changes: 65 additions & 0 deletions pm-workflow-pack/01-entity-and-persistence-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# PM Workflow Pack: Entity and Persistence Model

## Active Baseline

`Implemented behavior:` the root Gradle selectors mark `:current` as the active module and `:clockwork` as archived, so the entity/persistence model below is grounded first in `current/`. `settings.gradle.kts:6-10`, `build.gradle.kts:1-3`

## Core Workflow Entities

### 1. WorkItem

`Implemented behavior:` `WorkItem` is the core persisted workflow object. It stores hierarchy (`parentId`, `depth`), canonical workflow state (`role`), optional display state (`statusLabel`), suspension state (`previousRole`), prioritization (`priority`, `complexity`), verification flag (`requiresVerification`), metadata/tags, timestamps, and an optimistic-lock version. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/model/WorkItem.kt:7-25`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/model/Role.kt:4-6`, `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:4-25`, `current/src/main/resources/db/migration/V2__Work_Item_Field_Updates.sql:4-26`

`Implemented behavior:` the Exposed table definition matches the migration-level fields, including `requires_verification`, `role_changed_at`, and `version`. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/WorkItemsTable.kt:6-32`

`Implemented behavior:` repository reads/writes for `WorkItem` are centralized through `WorkItemRepository`, with create/update/delete, filter queries, tree queries, and ancestor-chain lookup. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/repository/WorkItemRepository.kt:9-98`

`Implemented behavior:` the active MCP server exposes both direct CRUD surfaces and workflow surfaces over `WorkItem` state by registering `manage_items`, `query_items`, `advance_item`, `get_next_status`, `get_next_item`, `get_blocked_items`, `complete_tree`, `create_work_tree`, and `get_context`. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/interfaces/mcp/CurrentMcpServer.kt:87-110,220`

### 2. Note

`Implemented behavior:` `Note` is a role-scoped accountability artifact attached to a `WorkItem`. It is unique by `(itemId, key)` and constrained to `queue`, `work`, or `review` roles. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/model/Note.kt:7-12,13-33`

`Implemented behavior:` notes are persisted in a dedicated `notes` table with timestamps and a unique index on `(work_item_id, key)`. `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:33-46`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/NotesTable.kt:7-20`

`Implemented behavior:` note persistence is exposed through `NoteRepository`, including upsert, delete, per-item queries, and batch lookup by item IDs. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/repository/NoteRepository.kt:6-13`

`Implemented behavior:` the active write surface for notes is `manage_notes`, which validates `itemId` existence before upsert and preserves existing note IDs on `(itemId, key)` collisions. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/tools/notes/ManageNotesTool.kt:128-177`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/SQLiteNoteRepository.kt:39-74`

### 3. Dependency

`Implemented behavior:` `Dependency` is a directed edge between `WorkItem`s. It supports `BLOCKS`, `IS_BLOCKED_BY`, and `RELATES_TO`, and can carry an `unblockAt` threshold for blocking semantics. Self-loops and invalid thresholds are rejected in the domain model. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/model/Dependency.kt:7-19,25-46`

`Implemented behavior:` dependencies are persisted in a dedicated `dependencies` table with uniqueness on `(from_item_id, to_item_id, type)`. `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:48-61`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/DependenciesTable.kt:7-20`

`Implemented behavior:` dependency persistence is exposed through `DependencyRepository`, including single writes, batch writes, graph lookup, delete, and cycle checks. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/repository/DependencyRepository.kt:6-30`

`Implemented behavior:` `manage_dependencies` is the active external write surface. It routes creates into `createBatch`, which applies duplicate and cycle validation atomically. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/tools/dependency/ManageDependenciesTool.kt:12-21,241-296`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/SQLiteDependencyRepository.kt:35-60,97-149,151-202`

### 4. RoleTransition

`Implemented behavior:` `RoleTransition` is a persisted audit record for workflow state changes. It stores `fromRole`, `toRole`, optional status labels, the trigger, summary, and the transition timestamp. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/model/RoleTransition.kt:6-23`

`Implemented behavior:` the audit records are stored in a dedicated `role_transitions` table with indexes by item and time. `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:63-77`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/RoleTransitionsTable.kt:7-21`

`Implemented behavior:` the repository surface supports create, per-item reads, time-range reads, `findSince`, and delete-by-item. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/domain/repository/RoleTransitionRepository.kt:7-12`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/SQLiteRoleTransitionRepository.kt:27-40,46-54,87-103`

## Relationships

`Implemented behavior:` `WorkItem` is self-referential through `parentId`, which creates a bounded depth hierarchy rather than separate project/feature/task tables in the active/current module. `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:4-25`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/tools/items/ManageItemsTool.kt:21-23,27-29,192-247`

`Implemented behavior:` `Note`, `Dependency`, and `RoleTransition` all reference `WorkItem` rows directly; notes and role transitions are deleted on item deletion, and dependencies cascade on either endpoint deletion. `current/src/main/resources/db/migration/V1__Current_Initial_Schema.sql:33-77`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/NotesTable.kt:15-20`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/DependenciesTable.kt:14-20`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/database/schema/RoleTransitionsTable.kt:17-20`

## Readers and Writers

`Implemented behavior:` the active/current tool layer reaches persistence through `ToolExecutionContext`, which exposes typed repository access for work items, notes, dependencies, role transitions, note schemas, and atomic work-tree execution. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/tools/ToolExecutionContext.kt:12-44`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/RepositoryProvider.kt:9-20`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/DefaultRepositoryProvider.kt:18-31`

`Implemented behavior:` the canonical SQLite-backed implementations are wired by `DefaultRepositoryProvider`, so `current` owns direct persistence for all four core entity types in the active runtime. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/DefaultRepositoryProvider.kt:18-31`

`Inferred capability:` because `create_work_tree` delegates to `WorkTreeExecutor`, and `DefaultRepositoryProvider` binds that interface to `SQLiteWorkTreeService`, the active/current module also owns an atomic multi-entity writer that can create items, dependencies, and notes in one transaction. `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/tools/compound/CreateWorkTreeTool.kt:292-307`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/application/service/WorkTreeExecutor.kt:33-39`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/repository/DefaultRepositoryProvider.kt:24-31`, `current/src/main/kotlin/io/github/jpicklyk/mcptask/current/infrastructure/service/SQLiteWorkTreeService.kt:26-33,38-130`

## Absent / No Evidence Found

`Absent/no evidence found:` no separate `Comment` entity or `CommentRepository` was found in the active/current scan scope (`current/src/main/kotlin`, `current/src/main/resources`, `current/src/test/kotlin`). Search: `rg -n --ignore-case 'class Comment|data class Comment|CommentRepository|comments table|comment_id' current/src/main/kotlin current/src/main/resources current/src/test/kotlin` returned no matches. See `99-evidence-index.md`, negative search `N2`.

`Absent/no evidence found:` no dedicated decision or progress persistence layer was found in the active/current scan scope. Search: `rg -n --ignore-case 'decision_id|decision table|progress table|progress record|decision record|decision repository|progress repository' current/src/main/kotlin current/src/main/resources current/src/test/kotlin` returned no matches. See `99-evidence-index.md`, negative search `N1`.
Loading
Loading