Back to index

Input and Output Processing

This document details how agent-sync processes input files and generates output files.

Glob Pattern Support in Inputs

The inputs field supports glob patterns with doublestar support for recursive matching and exclusions. Input paths are always resolved relative to the configuration file directory (where your agent-sync.yml is located):

Pattern Description
*.md All Markdown files in the current directory
**/*.md All Markdown files in any subdirectory (recursive)
!*_test.md Exclude all test Markdown files

For detailed information about glob pattern syntax and behavior, see the Glob Patterns documentation.

Examples

inputs:
  # Include all Markdown files in commands directory and subdirectories
  - "commands/**/*.md"
  # Exclude test files
  - "!commands/**/*_test.md"
  # Exclude specific temporary file
  - "!commands/temp.md"

Pattern Order and Precedence

  1. All include patterns (without ! prefix) are processed first
  2. Then exclude patterns (with ! prefix) are applied to filter the results
  3. The final list of files is sorted alphabetically by path

Note: The final list of files will be sorted alphabetically by path. If you need files to be processed in a specific order, list them individually without glob patterns.

Relationship Between outputDirs and outputs

The outputDirs setting (at the project level or root level in simplified format) defines the base directories where files will be generated. The outputs setting within each task defines which agents to generate files for and optionally the specific paths relative to the base directories.

Example:

outputDirs:
  - ~/projects/my-app
  - ~/projects/my-app-worktree
tasks:
  - type: memory
    outputs:
      - agent: roo
        # Will be generated in both:
        # ~/projects/my-app/.roo/rules/
        # ~/projects/my-app-worktree/.roo/rules/

Handling of Relative Output Directories

When specifying output directories in the outputDirs setting:

This approach allows you to specify output directories relative to your configuration file, making configurations more portable across different environments, while ensuring that all paths used internally are unambiguous.

Example:

# If agent-sync.yml is located at /path/to/project/agent-sync.yml
outputDirs:
  - dist  # Will be resolved to absolute path: /path/to/project/dist

Output Path Interpretation

The format of the outputPath determines how files are processed:

The outputPath can be specified as either relative or absolute:

Trailing slash rule and aggregation examples:

For example:

If outputPath is not specified, the agent’s default path is used (see “Default Output Path Behavior” sections below).

Default Output Path Behavior

When no outputPath is specified, the following default paths are used. The path format (with or without trailing slash) determines whether files are concatenated or kept separate:

Agent Task Type Default Path Concatenation Behavior
Claude memory CLAUDE.md or ~/.claude/CLAUDE.md Concatenated (file path)
Claude command .claude/commands/ Non-concatenated (directory path)
Claude mode .claude/agents/ or ~/.claude/agents/ Non-concatenated (directory path, per-mode files)
Roo memory .roo/rules/ Non-concatenated (directory path)
Roo command .roo/commands/ or ~/.roo/commands/ Non-concatenated (directory path; Roo slash commands per file)
Roo mode .roomodes (project; aggregation) or (user) VS Code globalStorage custom_modes.yaml (aggregation). User-scope OS-specific locations: macOS ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml, Linux ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml, Windows %APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\custom_modes.yaml Concatenated (single file aggregation)
Cline memory .clinerules/ or ~/Documents/Cline/Rules/ Non-concatenated (directory path)
Cline command .clinerules/workflows/ or ~/Documents/Cline/Workflows/ Non-concatenated (directory path)
Copilot memory .github/copilot-instructions.md or ~/.vscode/copilot-instructions.md Concatenated (file path)
Copilot command .github/prompts/ or ~/.vscode/prompts/ Non-concatenated (directory path)

Task Processing Workflow

When the agent-sync apply command is executed, the following workflow occurs:

  1. Configuration Loading: The configuration file is loaded and validated.
  2. Task Selection: If specific projects are provided as command arguments, only those projects’ tasks are processed. Otherwise, all projects and user tasks are processed.
  3. Input Processing:
  4. Output Generation:
  5. Verification: Optionally, with the --dry-run flag, the process will show what would be generated without actually writing files. The enhanced output displays content organized by agent with file status ([CREATE], [MODIFY], [UNCHANGED]), file paths, sizes, and per-agent summaries.

Previous Next
Template System Glob Patterns

Back to index