Skip to main content

Module agents

Module agents 

Source
Expand description

AGENTS.md generation and injection.

Provides marker-based section injection into AGENTS.md files. Core logic uses pure &str → String functions for testability, with a thin I/O wrapper for file operations.

Structs§

WorktreeAssignment
Reads a file (or treats a missing file as empty), injects section, and writes the result back. Per-worktree assignment context passed by the session launch flow.

Functions§

exclude_from_git
Adds filename to the worktree’s .git/info/exclude if not already present.
generate_worktree_section
Generates a marker-delimited assignment section for a worktree’s AGENTS.md.
has_git_paw_section
Returns true if content contains a git-paw section start marker.
inject_into_content
Injects section into content: appends if no git-paw section exists, replaces the existing one if present.
inject_section_into_file
replace_git_paw_section
Replaces the git-paw section (start marker through end marker, inclusive) with new_section. If the end marker is missing, replaces from the start marker to EOF.
setup_worktree_agents_md
Reads the root repo’s AGENTS.md, injects the worktree assignment section, writes the result to the worktree root, and excludes it from git.