Skip to content

Commit b926083

Browse files
committed
Integrate agent-trajectories for PDERO paradigm tracking
Adds integration with the external agent-trajectories package (trail CLI) to provide train-of-thought trajectory tracking following the PDERO paradigm (Plan, Design, Execute, Review, Observe). Key changes: - Add agent-trajectories as dependency - Create trajectory integration module (src/trajectory/integration.ts) - Wraps trail CLI calls for programmatic access - Provides TrajectoryIntegration class for stateful tracking - Includes PDERO phase detection from content - Integrate trajectory capture in tmux-wrapper: - Auto-record messages sent/received - Auto-detect PDERO phase transitions from agent output - Add `agent-relay trail` proxy command to forward to trail CLI Usage: agent-relay trail start "Implement feature X" agent-relay trail phase execute agent-relay trail decision "Use approach A" --reasoning "Better performance" agent-relay trail complete --summary "Feature implemented" References: https://github.com/AgentWorkforce/trajectories
1 parent 02a56de commit b926083

File tree

5 files changed

+535
-0
lines changed

5 files changed

+535
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
},
6262
"homepage": "https://github.com/khaliqgant/agent-relay#readme",
6363
"dependencies": {
64+
"agent-trajectories": "^0.1.0",
6465
"better-sqlite3": "^9.4.3",
6566
"chokidar": "^5.0.0",
6667
"commander": "^12.1.0",

src/cli/index.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,4 +1412,63 @@ program
14121412
}
14131413
});
14141414
1415+
// ============================================================================
1416+
// TRAJECTORY COMMANDS (trail proxy)
1417+
// ============================================================================
1418+
1419+
// trail - Proxy to trail CLI for trajectory tracking
1420+
program
1421+
.command('trail')
1422+
.description('Trajectory tracking commands (proxies to trail CLI)')
1423+
.argument('[args...]', 'Arguments to pass to trail CLI')
1424+
.allowUnknownOption()
1425+
.action(async (args: string[]) => {
1426+
const { spawn } = await import('node:child_process');
1427+
const { getProjectPaths } = await import('../utils/project-namespace.js');
1428+
1429+
const paths = getProjectPaths();
1430+
1431+
// Check if trail is available
1432+
const trailCheck = spawn('which', ['trail'], { stdio: 'pipe' });
1433+
const trailExists = await new Promise<boolean>((resolve) => {
1434+
trailCheck.on('close', (code) => resolve(code === 0));
1435+
trailCheck.on('error', () => resolve(false));
1436+
});
1437+
1438+
if (!trailExists) {
1439+
console.error('trail CLI not found. Install with: npm install -g agent-trajectories');
1440+
console.log('');
1441+
console.log('The trail CLI provides trajectory tracking for agent work:');
1442+
console.log(' trail start "<task>" Start tracking a new trajectory');
1443+
console.log(' trail status Show current trajectory status');
1444+
console.log(' trail phase <phase> Transition to PDERO phase');
1445+
console.log(' trail decision "<choice>" Record a decision');
1446+
console.log(' trail complete Complete the trajectory');
1447+
console.log(' trail list List all trajectories');
1448+
console.log('');
1449+
console.log('PDERO phases: plan, design, execute, review, observe');
1450+
process.exit(1);
1451+
}
1452+
1453+
// Spawn trail with the provided arguments
1454+
const trailProc = spawn('trail', args, {
1455+
cwd: paths.projectRoot,
1456+
stdio: 'inherit',
1457+
env: {
1458+
...process.env,
1459+
TRAJECTORIES_PROJECT: paths.projectId,
1460+
TRAJECTORIES_DATA_DIR: paths.dataDir,
1461+
},
1462+
});
1463+
1464+
trailProc.on('close', (code) => {
1465+
process.exit(code ?? 0);
1466+
});
1467+
1468+
trailProc.on('error', (err) => {
1469+
console.error(`Failed to run trail: ${err.message}`);
1470+
process.exit(1);
1471+
});
1472+
});
1473+
14151474
program.parse();

src/trajectory/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Trajectory Module
3+
*
4+
* Integrates agent-relay with the agent-trajectories package
5+
* for PDERO paradigm tracking (Plan, Design, Execute, Review, Observe)
6+
*/
7+
8+
export * from './integration.js';

0 commit comments

Comments
 (0)