[feat] Support custom workflow directories and flow-relative scripts
What problem does this solve?
I want to organize Taskflow definitions and their supporting shell scripts together in a project-owned directory.
For example:
.pi/taskflows/
└── flows/
├── my-flow.json
└── scripts/
├── prepare.sh
└── validate.sh
The JSON file defines the DAG, while the scripts are used by script phases in that DAG.
This would make larger workflow collections easier to organize, review, version, and share without placing every flow directly in the top-level .pi/taskflows/ directory.
Current workaround
I currently have to either:
- Store definitions directly in .pi/taskflows/
.json; or - Run custom definitions using defineFile, which does not provide the same automatic discovery and name-based execution behavior.
Scripts also need paths relative to the process working directory rather than naturally relative to the flow definition.
Proposed solution
Support a configurable project workflow directory, for example:
.pi/taskflows/flows/
Definitions in that directory should be discoverable and runnable by name:
.pi/taskflows/flows/my-flow.json
/tf:my-flow
Alternatively, support an explicit file command such as:
/tf run --file .pi/taskflows/flows/my-flow.json
For script phases, resolve relative paths from the flow's directory, or provide a flow-relative working directory:
{
"id": "prepare",
"type": "script",
"run": "./scripts/prepare.sh"
}
With:
.pi/taskflows/
└── flows/
├── my-flow.json
└── scripts/
└── prepare.sh
Possible configuration syntax:
{
"taskflow": {
"projectDirectory": ".pi/taskflows/flows"
}
}
The existing .pi/taskflows/
Potentially, flow-relative script resolution could be opt-in or explicitly configured if changing the current working-directory behavior would be breaking.
Alternatives considered
- Keep every flow directly under .pi/taskflows/.
- Use defineFile for every custom flow.
- Use scripts with paths relative to the repository root.
- Create wrapper files in .pi/taskflows/ that reference definitions stored elsewhere.
These approaches work, but they make larger workflow collections less cohesive and reduce the convenience of name-based flow discovery.
Is this a good fit?
- [x] It's an orchestration concern (not a subagent / model / prompting concern)
- [x] It fits the declarative JSON-DSL model (not imperative scripting)
- [x] It doesn't require new runtime dependencies