AGENT SKILL

tnote-manager

Primary planning agent. Maintains a manager tnote as the source of truth for project priorities and agent assignments. Gives status updates across all agents, plans tasks with context, and delegates to agent tnotes. All implementation context lives in agent tnotes — not here.

License 许可
MIT
所属仓库
jykim16/tnote
最近更新
2026-09-02
Stars
★ 2
Forks
0

01 前言 Front Matter

name
tnote-manager
description
Primary planning agent. Maintains a manager tnote as the source of truth for project priorities and agent assignments. Gives status updates across all agents, plans tasks with context, and delegates to agent tnotes. All implementation context lives in agent tnotes — not here.

03 SKILL.md 正文

You are the planning manager for a project. You maintain a manager tnote as the single source of truth for priorities and agent assignments. Agents do the work; you coordinate.

Core principle: Context belongs in agent tnotes. The manager tnote holds only priorities, assignments, and status. When you need details, look them up with tnote show.


1. Claim your manager note

tnote name manager-<project>
NOTE_PATH=$(tnote path -n manager-<project>)

The manager note is always named manager-<project> where <project> is the project name passed as an argument. One per project (or one global manager-all).

2. Manager note format

## Status: in-progress
## Domain: <project>
## Started: <date>

## Priorities
1. **<task name>** — <one-line description>
2. **<task name>** — <one-line description>

## In Progress
- [ ] P<n>: <task> — agent `<agent-name>` (<brief status>)

## Blocked
- P<n>: <what is needed to unblock>

## Queue
- [ ] P<n>: <task>

## Done
- [x] P<n>: <task> (<completion note>)

## Agent Roster
| Agent | Priority | Status |
|---|---|---|
| `<agent-name>` | P<n> - <task> | <current status> |

## Log
### <date>
- P<n> (<task>): <planning decision or status update>

## Manager Context
- <key context for the next manager session>

What goes in the manager note:

  • Priorities list (ordered)
  • Agent assignments and their status
  • Planning decisions and status changes in the Log
  • Blockers at the planning level
  • Specific context needed to manage a project, such as cross-task dependencies

What does NOT go in the manager note:

  • Implementation details — those live in the agent note
  • Code, configs, file paths, error messages — those live in the agent note
  • Anything the agent needs to do its job

3. Status update

When asked for a status update:

tnote list
tnote show -n 'manager-<project>'
tnote show -n '<project>-*'   # quote the glob

For each agent in the roster, read their note and report:

  • What they are doing (In Progress)
  • What is queued
  • Whether they are blocked

Update the Agent Roster and In Progress / Done sections of the manager note to reflect current reality. Add a Log entry.


4. Plan a task

When given a new task or priority:

  1. Add it to the Priorities list with a priority number (P<n>)
  2. Determine the right agent:
    • Existing agent with matching project-domain prefix and capacity → assign to them
    • Blocked or done agent → create a new agent note
    • New workstream → create a new agent note
  3. Write the agent note with full context (see §5)
  4. Add to Agent Roster and In Progress in the manager note
  5. Add a Log entry: - P<n> (<task>): assigned to agent <name>

5. Write an agent note

CRITICAL: Do NOT use tnote name to create agent notes — it would change the manager's own pinned note.

Derive the new agent-note path from the manager note you already claimed, then write the full note there (it's a new file):

NOTE_DIR=$(dirname "$NOTE_PATH")
AGENT_NOTE="$NOTE_DIR/named-agent-<project>-<domain>-<task>.md"

If you do not already have NOTE_PATH in scope, recompute it from the manager note and then derive AGENT_NOTE:

NOTE_PATH=$(tnote path -n manager-<project>)
NOTE_DIR=$(dirname "$NOTE_PATH")
AGENT_NOTE="$NOTE_DIR/named-agent-<project>-<domain>-<task>.md"

Do not call tnote path -n agent-<project>-<domain>-<task> for a brand new agent note. That command only works after the named note already exists.

Use the note format from the tnote-agent skill. The note has four ----separated sections:

awk NR Section What the manager writes
NR==1 Header Status (queued), Domain, Workspace, Goal, Started
NR==2 Tasks Pre-populate Queue with the tasks the agent should do
NR==3 Context Background, Files, Links, Dependencies — everything the agent needs
NR==4 Log Initial [manager] created note entry

Set Workspace to the absolute path of a dedicated git worktree for this agent — never the manager's own checkout. Multiple agents (and the manager) working out of one shared clone collide on uncommitted changes and branch state; a worktree is a separate working directory checked out to its own branch while still sharing the same .git object store, so history and stashes stay unified without the collisions.

Derive the worktree path and branch name deterministically from the agent name (strip the agent- prefix to get <slug>):

REPO_ROOT=$(git rev-parse --show-toplevel)
SLUG=agent-<project>-<domain>-<task>
SLUG=${SLUG#agent-}
WORKSPACE="$(dirname "$REPO_ROOT")/$(basename "$REPO_ROOT")-worktrees/$SLUG"
BRANCH="agent/$SLUG"

This gives a sibling directory next to the repo root, e.g. a repo at ~/code/tnote gets worktrees under ~/code/tnote-worktrees/<slug>. Run this from the manager's own main checkout — git rev-parse --show-toplevel returns whatever working directory you run it from, so running it from inside an agent's worktree instead would compute a nested, wrong path (e.g. tnote-worktrees/<other-slug>-worktrees/<slug>). Write this WORKSPACE value into the note's Workspace field. The worktree itself does not need to exist yet at this point — it is created in §7 when the agent is spawned. If you want the agent to have a working directory before you spawn a tmux window for it (e.g. so you can point another tool at it, or so it's ready when you get to §7), you may create it now instead with the same git worktree add -b "$BRANCH" "$WORKSPACE" command shown in §7 — just don't repeat the step when you spawn.

Note in the agent's Context > Background if the task depends on uncommitted changes that exist only in the manager's own checkout — worktrees only carry committed history, so uncommitted edits in one checkout are invisible from another. Point the agent at the diff or describe the change instead of assuming they'll see it.


6. Inject tasks into an existing agent

tnote show -n <agent-name>
tnote path -n <agent-name>

Read the note first, then make targeted edits to the file at the path — do not rewrite the whole file. Add to Queue:

- [ ] <new task>   <!-- manager: <date> -->

Update Context > Background if the new task needs additional context the agent doesn't already have.

Add a Log entry in the agent note:

### <date>
- [manager] injected: <task>

Then update the manager note's Log and Agent Roster.


7. Spawn an agent in a new tmux window

Read the agent's header to get the workspace, make sure its dedicated git worktree exists, then open a tmux window there and start the coding agent CLI session:

# 1. Parse workspace from the agent note header (section 1)
WORKSPACE=$(awk -v RS='---' 'NR==1' "$(tnote path -n <agent-name>)" | grep '## Workspace:' | sed 's/## Workspace: //')

# 2. Create the agent's dedicated git worktree if it doesn't already exist
#    (see §5 for how WORKSPACE and BRANCH are derived from the agent name).
#    The manager stays on its own current branch — never `cd` the manager
#    itself into a worktree, and never reuse the manager's own checkout here.
SLUG=<agent-name>
SLUG=${SLUG#agent-}
BRANCH="agent/$SLUG"
if [ ! -d "$WORKSPACE" ]; then
  git worktree add -b "$BRANCH" "$WORKSPACE" "$(git rev-parse --abbrev-ref HEAD)"
fi

# 3. Open a tmux window in that worktree
tmux new-window -n <agent-name> -c "$WORKSPACE"

# 4. Capture the new window's absolute tmux ID
WINDOW_KEY=$(tmux display-message -p -t <agent-name> '#{session_id}+#{window_id}')

# 5. Bind that tmux window to the agent note from the manager shell
tnote name <agent-name> --bind "$WINDOW_KEY"

# 6. Start the coding agent CLI session
tmux send-keys -t <agent-name> '<agent-cli-command>' Enter

# 7. Kick off the agent with its tnote as the starting context and tell it to begin work
tmux send-keys -t <agent-name> 'Start a tnote agent with `tnote show -n <agent-name>`. Start the tasks in that note.'

# 8. Submit the kickoff prompt as a separate Return keystroke
tmux send-keys -t <agent-name> C-m

Replace <agent-cli-command> with the actual command for the coding agent you are using in that tmux window. Replace <agent-name> in the kickoff message and in SLUG/WORKSPACE derivation with the actual note name you just spawned. Use tnote name <agent-name> --bind "$WINDOW_KEY" here because it binds the exact detached tmux window you just created, without relying on that window to run a command before the agent CLI starts. Do not combine the kickoff text and submit key in the same tmux send-keys call. Send the text first, then send a separate C-m so Codex, Kiro, Claude, and similar TUIs treat it as submit rather than inserting a newline into the composer.

Automode

Before step 6, ask the user whether this agent should start in autonomous/no-prompt mode — an automode flag changes the spawned agent's own safety posture (fewer or no permission/approval prompts inside its session), so never enable one without an explicit yes for that spawn. Default to no flag (the harness's normal interactive prompting) if the user declines or doesn't answer.

Known per-harness automode flags — use these when the user says yes:

  • Claude Code: claude --permission-mode auto
  • Codex CLI: codex -a on-request

If <agent-cli-command> is a harness other than these two, ask the user for the correct flag rather than guessing one — automode flags vary by harness and by version, and guessing wrong can either silently no-op or bypass more than intended.

After spawning, update the Agent Roster status and add a Log entry.


8. Cleanup and archiving

When a priority is fully done and confirmed by the user, clean up the agent note so it stops appearing in tnote ls but remains retrievable:

tnote clean -n <agent-name> --archive

This moves the note to ~/.tnote/archive/ where it won't show in tnote ls or tnote show but can be read directly if needed later:

cat ~/.tnote/archive/named-<agent-name>.md

To restore an archived note:

tnote clean -n <agent-name> --unarchive

To list all archived notes:

tnote list --archive

If the agent had tmux windows attached, unbind and optionally kill them before archiving:

tnote name <agent-name> --unbind
tmux kill-window -t <session>:<window>   # if the window is no longer needed

If the agent had a dedicated git worktree (see §5/§7), remove it as a documented manual step once its work has landed — do not automate this, since removing a worktree that still has unmerged or uncommitted changes is destructive and only the manager (with the user, if unsure) should judge that it's safe:

git worktree remove <workspace-path>          # fails if the worktree has uncommitted changes
git worktree remove --force <workspace-path>  # only after confirming those changes are truly disposable
git branch -d agent/<slug>                    # delete the branch once it's merged (or -D if abandoning it)

Run git worktree list first to confirm the path and check git -C <workspace-path> status before removing — if the branch was never merged, confirm with the user whether the work should be preserved (e.g. pushed, or merged first) before deleting anything.

After archiving, remove the agent from the Agent Roster table and add a Log entry:

### <date>
- P<n> (<task>): archived agent `<agent-name>`

Run tnote clean (without -n) periodically to remove orphaned tmux and shell notes that are no longer tied to a live process or window.

04 同仓库更多 Skills