Skip to content

Potential Fix: Explicitly instruct to use git mv when archiving tracks in implement.toml #72

@reosablo

Description

@reosablo

Problem

When archiving a completed track, the AI agent (Auto: Gemini 3) often uses the standard shell mv command and forgets to stage the deletion of the original files.

While this moves the files on disk, it leaves the deletion unstaged in git. Consequently, both the user and the AI agent may fail to notice these unstaged changes (appearing as "deleted" in git status).

Conversation log (Japanese)
> 今完了したトラックをアーカイブまたは削除したいです。どちらがよいでしょうか。

✦ conductor の運用ルール上、完了したトラックは アーカイブ することをお勧めします。

  削除してしまうと、過去の開発履歴や意思決定のコンテキスト(「なぜその機能が追加されたのか」「どのような議論があったのか」)が失われてしまい、将来的な保守や機能追加
  の際に不便になります。

  アーカイブの手順は以下の通りです:

   1. conductor/tracks/add-pre_commit_hooks/ ディレクトリを conductor/archive/add-pre_commit_hooks/ に移動する。
   2. conductor/tracks.md のリンクを更新する。

  この作業を実行してよろしいでしょうか?

> はい、お願いします。

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓  Shell mkdir -p conductor/archive && mv conductor/tracks/add-pre_commit_hooks conductor/archive/ [current working directory /home/xxx/app]    │
│                                                                                                                                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓  Edit conductor/tracks.md: | `add-pre_commit_hooks` | Int... => | `add-pre_commit_hooks` | Int...                                                               │
│                                                                                                                                                                   │
│ 6                                                                                                                                                                 │
│ 7   | ID | Title | Status | Priority | Link |                                                                                                                     │
│ 8   | --- | --- | --- | --- | --- |                                                                                                                               │
│ 9 - | `add-pre_commit_hooks` | Introduce pre-commit hooks for code quality | `completed` | medium | [details](./tracks/add-pre_commit_hooks/) |                   │
│ 9 + | `add-pre_commit_hooks` | Introduce pre-commit hooks for code quality | `completed` | medium | [details](./archive/add-pre_commit_hooks/) |                  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓  Shell git add conductor/archive/add-pre_commit_hooks conductor/tracks.md && git commit -m "chore(conductor): Archive completed track 'add-pre_commit_hooks'" … │
│                                                                                                                                                                   │
│ Unstaged changes detected, stashing unstaged changes to `/home/xxx/.cache/prek/patches/1768637276157-7696.patch`                                                  │
│ check for merge conflicts................................................Passed                                                                                   │
│ ruff format..........................................(no files to check)Skipped                                                                                   │
│ ruff check...........................................(no files to check)Skipped                                                                                   │
│ basedpyright.........................................(no files to check)Skipped                                                                                   │
│ pytest...............................................(no files to check)Skipped                                                                                   │
│ Restored working tree changes from `/home/xxx/.cache/prek/patches/1768637276157-7696.patch`                                                                       │
│ [main d7a26c7] chore(conductor): Archive completed track 'add-pre_commit_hooks'                                                                                   │
│  4 files changed, 46 insertions(+), 1 deletion(-)                                                                                                                 │
│  create mode 100644 conductor/archive/add-pre_commit_hooks/metadata.json                                                                                          │
│  create mode 100644 conductor/archive/add-pre_commit_hooks/plan.md                                                                                                │
│  create mode 100644 conductor/archive/add-pre_commit_hooks/spec.md                                                                                                │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 完了したトラック add-pre_commit_hooks を conductor/archive/ に移動し、tracks.md のリンクも更新しました。

  これにより、アクティブなトラック一覧が整理され、履歴も適切に保存された状態になりました。

  本日の作業はこれで完了でよろしいでしょうか?他に何かお手伝いできることがあればお知らせください。
$ git status
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓  Shell Command git status                                                                                                                                       │
│                                                                                                                                                                   │
│ On branch main                                                                                                                                                    │
│ Changes not staged for commit:                                                                                                                                    │
│   (use "git add/rm <file>..." to update what will be committed)                                                                                                   │
│   (use "git restore <file>..." to discard changes in working directory)                                                                                           │
│         deleted:    conductor/tracks/add-pre_commit_hooks/metadata.json                                                                                           │
│         deleted:    conductor/tracks/add-pre_commit_hooks/plan.md                                                                                                 │
│         deleted:    conductor/tracks/add-pre_commit_hooks/spec.md                                                                                                 │
│                                                                                                                                                                   │
│ no changes added to commit (use "git add" and/or "git commit -a")                                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Context

This behavior seems to stem from the instruction in commands/conductor/implement.toml (Step 3.ii), which generically says "Move the track's folder". This ambiguity allows the agent to choose mv, which doesn't handle git staging automatically.

Proposed Solution

Update commands/conductor/implement.toml to explicitly instruct the usage of git mv for archiving operations.

3. **Handle User Response:**
* **If user chooses "A" (Archive):**
i. **Create Archive Directory:** Check for the existence of `conductor/archive/`. If it does not exist, create it.
ii. **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`.
iii. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track (the part that starts with `---` and contains the track description), and write the modified content back to the file.
iv. **Commit Changes:** Stage the **Tracks Registry** file and `conductor/archive/`. Commit with the message `chore(conductor): Archive track '<track_description>'`.
v. **Announce Success:** Announce: "Track '<track_description>' has been successfully archived."

- ii.  **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`.
+ ii.  **Archive Track Folder:** Use `git mv` to move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`.

This explicit instruction ensures the agent preserves file history and correctly stages the move in a single atomic operation.

Note: I haven't verified this fix locally as I only reviewed the code on the repository. I would appreciate it if you could verify if this resolves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions