Documentation
¶
Overview ¶
Package taskctx stores a working note per git branch so an agent can resume a task after a new chat or a branch switch.
Notes live in <git-common-dir>/kartograf/context/. Checkout does not touch that directory, and the files sit outside the working tree, so they stay put across branch switches and are not committed. The code index database is a rebuildable cache and is not used here.
Index ¶
- Constants
- func ChangedFiles(root, branch string) (base string, files []string, err error)
- func CurrentBranch(root string) (string, error)
- func HandoffNudge(root, sessionID string, stopHookActive bool) string
- func HookText(root, sessionID string) string
- func Repo(root, rel string) (string, error)
- func StaleFiles(root string, note Note) []string
- type Note
- type Summary
- type TaskMatch
Constants ¶
const MaxBody = 4 << 10
MaxBody is the maximum stored note size in bytes. A note is a handoff for a later chat (what was done, why, what is left), written once when work pauses. 4 KiB is enough for that in Russian, where each letter is two bytes, and small enough to inject once per session.
Variables ¶
This section is empty.
Functions ¶
func ChangedFiles ¶ added in v0.1.15
ChangedFiles lists files this branch changed relative to the repository's default branch (origin/HEAD, else main, else master). An empty branch means the checkout at root. The returned paths are relative to root.
func CurrentBranch ¶
CurrentBranch reports the branch checked out at root. A detached HEAD is reported as HEAD@<12-char sha> so unrelated detached states do not share one note.
func HandoffNudge ¶ added in v0.1.16
HandoffNudge is the Stop-hook reminder. It is empty when the note already covers the branch, when this session was already reminded for the branch, or when stopHookActive says this turn is itself the reminder. One reminder per session and branch, so it cannot loop.
func HookText ¶
HookText is the prompt-hook block for the current branch. sessionID scopes the injection to one chat: the handoff is shown on the first prompt of that session and not again, because a repeated block would stay in the transcript and be paid for on every later turn. Checking out a different branch shows that branch's handoff once. An empty sessionID injects nothing. Other branches' handoffs are listed by name so follow-up work on a new branch can find last week's note. The result is empty when there is nothing saved or git is unavailable — a hook must stay silent rather than fail the prompt.
func Repo ¶ added in v0.1.15
Repo resolves a root-relative repository directory returned by FindTask. An empty rel is the serve root. The result must be a git checkout inside root.
func StaleFiles ¶ added in v0.1.15
StaleFiles returns paths named in the note whose latest commit is newer than the note. A later chat can see that the handoff is talking about code that has since moved.
Types ¶
type Note ¶
Note is the full working note for one branch.