When working with the goose CLI, you can pass files and instructions to the `goose run` command to execute tasks and workflows. This could be a simple one-liner command or a complex set of instructions stored in a file.
The `goose run` command starts a new session, begins executing using any arguments provided and exits the session automatically once the task is complete.
Using the `-t` flag, one is able to pass a text instruction directly to the command. This is great for quick, one-off commands where you do not need an interactive session with goose. The instructions will be executed, and the session will end. An example usage could be using in a CI/CD pipeline or running alongside other scripts.
If you have a complex set of instructions or a workflow that you want to automate, you can store them in a file and pass it to the `goose run` command:
```bash
goose run -i instructions.md
```
Here's an example of an instruction file that runs a security audit on project dependencies:
```md
# Dependency Security Audit
1. Analyze project dependencies:
- Check package.json and requirements.txt files
- List all dependencies with versions
- Identify outdated packages
2. Security check:
- Run npm audit (for JavaScript packages)
- Check for known vulnerabilities in Python packages
- Identify dependencies with critical security issues
3. Create an upgrade plan:
- List packages requiring immediate updates
- Note breaking changes in latest versions
- Estimate impact of required updates
Save findings in 'security_audit.md' with severity levels highlighted.
You can also pass instructions to goose using standard input via `-i -`. This is useful when you want to pipe commands from another tool or script into goose.
If you don't want goose to exit at the end of the task, you can pass the `-s` or `--interactive` flag to start an interactive session after processing your initial commands:
You can also run commands without creating or storing a session file by using the `--no-session` flag. This is useful for automated scripts, or one-off tasks where you don't need to maintain the conversation history or state. This flag routes the session output to a temporary null path (`/dev/null` on Unix or `NUL` on Windows), and discards it when complete.
You can run goose sessions with a specific provider and model, which overrides the provider and model settings in your [environment variables](/docs/guides/environment-variables.md).
If you want to ensure specific extensions are available when running your task, you can indicate this with arguments. This can be done using the `--with-extension`, `--with-remote-extension`, `--with-streamable-http-extension`, or `--with-builtin` flags:
When troubleshooting or developing complex workflows, you can enable debug mode to get more detailed information about tool execution. The `--debug` flag provides: