跳到正文
DEV Community· Hassann·· 4 小時前AI 評分61

AI 智能體的決策應記錄在程式碼庫還是任務中?

Where AI Agent Decisions Live: In the Repo or on the Board?

AI 導讀

文章提出,AI 智能體的程式碼決策應記錄在程式碼庫,工作範圍、負責人及變更原因則應記錄在任務中。AGENTS.md 或 CLAUDE.md 保存慣例、命令和規則,架構決策可記入 ADR;任務描述則整理當前工作決策,留言保留變更過程。

正文

Where AI agent decisions should live: the repo or the task?

Quick answer: AI agent decisions belong in two places, split by what they govern. Decisions about the code (conventions, architecture, build commands) go in the repo, in AGENTS.md, CLAUDE.md or an architecture decision record, so they ship with the branch. Decisions about the work (scope, owner, what changed and why) go on the task, where every agent and person reads them before starting.

Start Free on Web

A builder running several coding agents hit a familiar wall. One agent agreed an approach in its session, a different agent picked up the follow-up the next morning, and nothing it read said what had been agreed. Their conclusion: decisions have to live in the project, not in one tool's chat. Their question to us was direct. Where does Sharkly keep those decisions, in the repo or in its own store?

The honest answer is both, and the split isn't arbitrary. This post gives you a rule for which AI agent decisions go where, shows what Sharkly stores and what an agent reads when it picks up a task, and ends with a two-file setup you can copy today.

Why AI agent decisions get lost between sessions

Every coding agent session starts from a fresh context window. Whatever you agreed inside that window disappears with it unless something writes it down.

Tool memory doesn't fix this across agents. Claude Code keeps its auto memory under ~/.claude/projects/<project>/memory/, and Anthropic's memory documentation states that auto memory stays on the computer where it was written and isn't shared with other computers or cloud environments. Codex can't read it. Neither can a teammate's Claude Code on another laptop.

So the human becomes the router, the shared memory and the reviewer. You paste yesterday's conclusion into today's prompt. You remember which agent was told to keep the old endpoint. That works with one agent. With three, you're the bottleneck, and the decision you forgot to paste is the one the next agent quietly reverses.

The fix is to give each decision a home that the next reader, human or agent, opens by default. How to keep context when switching between coding agents covers the handoff mechanics. This post is about where the decision itself should live.

Shared memory for AI coding agents: repo or board?

One rule settles most cases: if a decision should change when the code changes, it belongs in the repo. If it should change when the work changes, it belongs on the board. Code decisions are versioned with the branch and reviewed in pull requests. Work decisions belong to one task, one owner and one moment, and they go stale when the task closes.

Decision Example Home Why there
Coding convention "Use pnpm, never npm" AGENTS.md or CLAUDE.md Every session in the repo must obey it
Build and test commands pnpm test --filter api AGENTS.md Agents run it, and it changes with the code
Architecture choice "Events go through the outbox table" ADR in docs/adr/ Needs a reason that outlives any one task
Scope of this task "Keep v1 unchanged until Q1" Task description Applies to this work only
Who owns which part "Codex writes the migration, Claude Code reviews" Assignee plus description Changes as the work moves
Mid-task change of plan "Drop offset paging, ship cursors" Task comment, then the description Needs a timestamp and an author
Team process "Every PR gets a reviewer pass" Agent instructions or a Skill Spans tasks, not code

Two traps sit on either side of this table. Put task decisions in AGENTS.md and the file turns into a changelog of one-off agreements: every session pays tokens to read it, and stale rules outlive their tasks. Put architecture decisions only on the board and the next contributor reading the code never sees why. A task closed six months ago is not where anyone looks.

Michael Nygard's original ADR post makes the case for keeping those records next to the code, and adr.github.io collects templates.

Schema of where AI agent decisions live: code decisions (AGENTS.md or CLAUDE.md, and ADRs) sit in the Git repo and travel with the branch, work decisions (task description and task comments) and team rules (Agent instructions and Skills) sit on the board, and a decision made in a chat is promoted to a task comment, then to the description, and to the repo only if it becomes a lasting code rule

What goes in AGENTS.md versus an ADR?

AGENTS.md holds the rules an agent must follow right now: commands, conventions, guardrails. The AGENTS.md format is a plain Markdown file used by over 60,000 open-source projects, and OpenAI's docs say Codex reads AGENTS.md before doing any work. Claude Code reads CLAUDE.md and can read an existing AGENTS.md in its place.

An ADR holds the reasoning: the context, the options, the choice and its consequences. Keep AGENTS.md short and link to the ADR. The agent gets the rule, and the reason stays one click away.

Where should a decision made in chat go?

Nowhere final yet. A chat decision is a draft until someone writes it where the next agent reads. Promote it in order: a task comment the moment it's agreed, the task description once it holds, and the repo only if it becomes a lasting rule about the code.

How Sharkly stores decisions an agent can read

Sharkly has no separate "decision log" object. Decisions live in the places a run already reads. According to the Agent task execution docs, a task-backed run can include:

  • the task title and description;
  • status, priority, Project, Sprint and labels;
  • recent comments and the comment that triggered the run;
  • the Agent's instructions and assigned Skills;
  • the Agent or Space Git repositories.

The last item is the bridge. When a run checks out your repository, the coding agent reads AGENTS.md or CLAUDE.md the way it always does. Sharkly doesn't copy those files into its own store, and it doesn't need to. Code decisions stay in Git, work decisions stay on the task, and the run puts both in front of the agent.

A Sharkly Agent's settings panel with its Instructions, Git repositories and Skills rows boxed: these three are carried into every run the Agent starts

Agent instructions add a third layer. The settings panel describes them as text that every task carries, and the Agents docs note that instructions keep version history, so a bad edit is one restore away. Use them for how an agent works (role, checks, when to ask), not for what one task agreed. A procedure several agents share belongs in a Skill.

If your decisions currently live in four chat windows, start free on Sharkly, move one task's agreements into its description, and assign the next run to a different agent.

Sequence of an agent picking up a task in Sharkly: a person writes the decision into the task description, Sharkly dispatches the run to the Computer with the description, recent comments, instructions and Skills, the coding agent checks out the repo and reads AGENTS.md and the linked ADR, reads a linked Shared doc through the sharkly CLI, then posts its result as a task comment, and the person promotes any new decision into the description

Where Sharkly has gaps, and the workarounds

Three gaps, stated plainly:

  1. Only recent comments ride along. A decision buried far back in a long thread may not reach the run. Promote anything still binding into the description under a "Decisions" heading.
  2. Agent Chat is not a task comment. The chat docs say a message in Agent Chat doesn't create a task comment, so a conclusion reached there is invisible to the next run. Copy it into the description or a comment.
  3. The Docs library isn't in the run context by default. Shared docs are versioned and searchable, and an agent can read one with sharkly docs document view, but only when something tells it to. Link the doc from the task description and write "read this first".

A setup you can copy today

Two files cover it: one in the repo, one on every task.

1. Add a decisions pointer to AGENTS.md

# AGENTS.md

## Commands
- Install: pnpm install
- Test: pnpm test --filter api

## Conventions
- TypeScript strict mode; no default exports.
- Database access only through src/db/repo.ts.

## Decisions
- Architecture decisions live in docs/adr/. Read every ADR a change touches before editing.
- Task decisions (scope, owner, what changed) live in the task description, not here.
- If a task decision should become a lasting rule, propose an ADR in the pull request.

2. Give every task a Decisions block

## Goal
Add cursor pagination to GET /v2/orders.

## Decisions (current state, newest wins)
- 2026-11-28: Keep /v1/orders unchanged until the Q1 deprecation.
- 2026-11-29: Page size max 100, default 25.
- 2026-11-29: Codex writes the migration; Claude Code reviews the PR.

## Out of scope
- Offset pagination on /v1.

## Read first
- docs/adr/0007-cursor-pagination.md
- Shared doc: Orders API style guide

The "newest wins" line does the heavy lifting. When a later comment changes a decision, edit the block and leave the comment as the audit trail. The description holds the current answer, and the comments hold how you got there. For fuller handoff formats, see coding-agent handoff templates.

Alternatives if you don't use a board

  • Repo only. A docs/decisions/ folder plus a TASK.md per branch. It works for one person, but nobody outside the branch sees task decisions until merge.
  • Tool memory. Fine for personal preferences. It stays on one computer inside one tool, so a second agent never sees it.

If you run two agents on one repo today, how to run Claude Code and Codex together shows the worktree side of the same problem.

Conclusion

Code decisions go in the repo. Work decisions go on the task. Chat holds neither until someone promotes it.

Your next step takes ten minutes: pick one active task, add the Decisions block, add the pointer to AGENTS.md, and assign the next run to a different agent than the last one. If it starts from what was agreed without you pasting anything, the split works. Then set up the same flow in Sharkly so every run reads it by default.

FAQ

Should I put task decisions in AGENTS.md?

No. AGENTS.md is read by every session in the repo, so one-off agreements cost tokens on unrelated work and outlive the task. Keep it to commands, conventions and pointers. Task scope belongs in the task description.

Do coding agents share memory with each other?

Not by default. Claude Code's auto memory stays on the computer that wrote it, and each tool keeps its own session state. Shared memory has to be a file or a record that every agent reads: the repo for code rules, the task for work decisions.

What is an architecture decision record?

An ADR is a short Markdown file that records one architecture decision: the context, the choice and its consequences. Teams keep them in the repo, often in docs/adr/, so the reason travels with the code.

Does Sharkly sync AGENTS.md or CLAUDE.md into its own store?

No. Sharkly checks out the Agent or Space repositories for the run, and the coding agent reads those files from the working directory as usual. The repo stays the source of truth for code decisions.

How do I stop an agent reversing an earlier decision?

Write the decision where the agent reads it before starting: the task description for this work, AGENTS.md or an ADR for the codebase. Then tell the agent in its instructions to read the Decisions block first.

Where should decisions made in Agent Chat go?

Copy them into the task description or a task comment. Agent Chat messages don't become task comments, so the next run won't see them otherwise.

來源:DEV Community · dev.to