Resource Management

AgileBuilder's two resource types (templates and documents), the difference between local and Cloud workspaces, and the complete res command workflow.

AgileBuilder CLI manages reusable development assets as "resources". There are two resource types:

TypeDescription
templateA pointer to a Git repository: repo URL, branch (default main), and an optional subdirectory inside the repo. Used by ag create to scaffold projects.
docMarkdown or plain-text content managed by the CLI as reference material; also exposed to AI agents through MCP resources.

Resources live in workspaces. AgileBuilder has two kinds:

  • Local workspace (local): built in, no login required. Resources are stored on your machine at ~/.agilebuilder/v2/resources/local.json as a flat list with no folder tree.
  • Cloud workspaces: provided by AgileBuilder Cloud and require ag login first. They support folders (--parent-id) and can be shared with your team.

The current workspace determines which resources res commands and create <resource-id> read and write.

Selecting and Switching Workspaces

ag space list            # List local and Cloud workspaces
ag space list --refresh  # Re-fetch the Cloud workspace list (recommended after your first login)
ag space current         # Show the current workspace
ag space use local       # Use the local workspace
ag space use <space-id>  # Switch to a Cloud workspace

To run a single operation against a Cloud workspace without switching, use --space-id:

ag res list --space-id <space-id>
ag res add template --space-id <space-id> --name api --git-url https://github.com/example/api-template.git
ag res remove <resource-id> --space-id <space-id> --yes

Registering Template Resources

A template resource is essentially a Git repository record. Register a team template in the local workspace:

ag space use local
ag res add template \
  --name service-template \
  --git-url https://github.com/example/service-template.git \
  --branch main \
  --subdir templates/node \
  --description "Node.js service starter" \
  --tags "node,service"

Options:

OptionRequiredDescription
--name <name>YesResource name.
--git-url <url>YesGit repository URL.
--branch <branch>NoDefaults to main.
--subdir <path>NoTemplate directory inside the repository (for repos that host multiple templates).
--parent-id <id>NoParent folder node ID; Cloud only.
--space-id <id>NoTarget workspace; defaults to the current workspace.
--description <text>NoResource description.
--tags <tags>NoComma-separated tags.
--jsonNoOutput JSON.

Registering a template only stores the pointer — nothing is cloned until you run ag create.

Registering Document Resources

Document resources carry team conventions, architecture notes, API contracts, and similar knowledge. Content comes from a file or inline text — at least one of the two is required:

ag res add doc \
  --name architecture-notes \
  --file ./docs/architecture.md \
  --format markdown \
  --tags "docs,architecture"

ag res add doc --name api-conventions --content "# API conventions ..."
OptionRequiredDescription
--name <name>YesResource name.
--file <path>Either/or with --contentRead content from a file.
--content <text>Either/or with --filePass text content directly.
--uri <uri>NoDocument URI; local docs default to local-doc://<name>.
--format <format>Nomarkdown or text; defaults to markdown.
--parent-id <id>NoCloud only.
--space-id <id>NoDefaults to the current workspace.
--description <text>NoResource description.
--tags <tags>NoComma-separated tags.
--jsonNoOutput JSON.

Document resources pay off when AI agents consume them: through agilebuilder-mcp, docs are exposed as MCP resources (URIs like agilebuilder://local/docs/<id> and agilebuilder://cloud/docs/<id>), so an agent can read your team's conventions before generating code. See MCP Integration.

Listing, Searching, and Inspecting

ag res list                       # All resources in the current workspace
ag res list --type template       # Templates only
ag res search auth                # Keyword search
ag res search auth --type doc     # Search documents only
ag res get 1                      # Show resource details

res can be written as resource, and list as ls. Every listed entry carries a resource ID, which create, get, edit, and remove use to reference it.

Creating a Project from a Template Resource

ag create 1 --target ./my-app

The CLI shallow-clones the template using the Git URL, branch, and subdirectory recorded on the resource, renders the variables, and writes the result to the target directory. At creation time you can override the recorded --branch and --subdir, and pass template variables via --var / --vars / --interactive. See CLI Reference for the full option list, and Create Your First Template for how templates themselves are built.

Editing and Removing

ag res edit 1 --name new-name --description "Updated"
ag res edit 1 --tags "backend,starter"
ag res edit 2 --file ./README.md --format markdown   # Update document content
ag res remove 1 --yes

Validation rules:

  • At least one editable field is required.
  • --file and --content cannot be used together.
  • Template-only fields (--git-url, --branch, --subdir) cannot be used on document resources, and vice versa.
  • --parent-id is only available for Cloud resources.
  • Removal requires an explicit --yes confirmation.

JSON Output for Scripts and AI Agents

All res subcommands support --json, producing structured results; errors carry code, message, suggestion, and category fields:

ag res list --json
ag res search auth --type doc --json
ag res rm 1 --yes --json

See CLI Reference for the protocol details and the error code table.

Known Limitations

  • The local workspace is a flat list with no folders; folder organization is only available in Cloud workspaces.
  • Cloud operations depend on backend API availability and your permissions.