Use when implementing self-learning agent workflows. Triggers: "agent learning", "trajectory", "pattern recognition", "AgentDB", "self-learning agent". NOT for: Basic agent operations without learning requirements.
/plugin marketplace add pagerguild/guilde-lite/plugin install pagerguild-agentic-flow-plugins-agentic-flow@pagerguild/guilde-liteThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/README.mdreferences/README.mdExpert guidance for self-learning agent workflows using AgentDB.
AgentDB is a persistent knowledge base that:
A trajectory is a recorded sequence of operations:
┌─────────────────────────────────────────────────┐
│ Trajectory: "implement-auth-feature" │
│ │
│ Step 1: create_file src/auth.ts │
│ Step 2: edit_file src/auth.ts (add login) │
│ Step 3: create_file src/auth.test.ts │
│ Step 4: run_tests (pass) │
│ │
│ Score: 0.95 Status: Completed │
└─────────────────────────────────────────────────┘
const { JjWrapper } = require('agentic-jujutsu');
const jj = new JjWrapper();
await jj.enableAgentCoordination();
// Start tracking a workflow
const trajectoryId = await jj.startTrajectory('implement user authentication');
// Add each significant operation
await jj.addToTrajectory(trajectoryId, {
action: 'create_file',
file: 'src/auth/login.ts',
success: true,
metadata: {
lines: 45,
imports: ['bcrypt', 'jwt']
}
});
await jj.addToTrajectory(trajectoryId, {
action: 'run_tests',
success: true,
metadata: {
passed: 12,
failed: 0,
coverage: 0.85
}
});
// Mark as complete with score and critique
await jj.finalizeTrajectory(
trajectoryId,
0.92, // Score (0-1)
'Successfully implemented with good test coverage'
);
// Find similar past workflows
const similar = await jj.queryTrajectories(
'implement user registration', // Task description
5 // Max results
);
// Returns trajectories with similarity scores
// [{trajectoryId, task, score, similarity, operations}]
// Get AI-powered suggestion for a task
const suggestion = await jj.getSuggestion('add password reset feature');
// Returns recommended approach based on learned patterns
// {
// recommendedSteps: [...],
// similarTrajectories: [...],
// confidence: 0.85
// }
// Get discovered patterns
const patterns = await jj.getPatterns();
// Returns common successful patterns
// [{pattern, frequency, avgScore, examples}]
const stats = await jj.getLearningStats();
// {
// totalTrajectories: 156,
// successfulTrajectories: 142,
// successRate: 0.91,
// topPatterns: [...],
// recentLearnings: [...]
// }
// Record TDD workflow
const id = await jj.startTrajectory('TDD: implement feature X');
// RED phase
await jj.addToTrajectory(id, {
action: 'create_test',
file: 'feature.test.ts',
success: true,
phase: 'red'
});
await jj.addToTrajectory(id, {
action: 'run_tests',
success: false, // Expected to fail
phase: 'red'
});
// GREEN phase
await jj.addToTrajectory(id, {
action: 'implement',
file: 'feature.ts',
success: true,
phase: 'green'
});
await jj.addToTrajectory(id, {
action: 'run_tests',
success: true,
phase: 'green'
});
// REFACTOR phase
await jj.addToTrajectory(id, {
action: 'refactor',
file: 'feature.ts',
success: true,
phase: 'refactor'
});
await jj.finalizeTrajectory(id, 0.95, 'TDD cycle complete');
// Track review outcomes
const id = await jj.startTrajectory('code-review: PR #123');
await jj.addToTrajectory(id, {
action: 'review_security',
findings: 2,
severity: 'medium'
});
await jj.addToTrajectory(id, {
action: 'review_quality',
findings: 5,
severity: 'low'
});
await jj.addToTrajectory(id, {
action: 'fixes_applied',
success: true
});
await jj.finalizeTrajectory(id, 0.88, 'Review complete, issues resolved');
// Learn from errors
const id = await jj.startTrajectory('debug: authentication failure');
await jj.addToTrajectory(id, {
action: 'investigate',
finding: 'token_expired',
success: true
});
await jj.addToTrajectory(id, {
action: 'fix_applied',
solution: 'refresh_token_logic',
success: true
});
await jj.addToTrajectory(id, {
action: 'verify_fix',
tests_passed: true,
success: true
});
await jj.finalizeTrajectory(id, 1.0, 'Bug fixed and verified');
// Next time similar error occurs:
const suggestion = await jj.getSuggestion('authentication failure');
// Will recommend checking token expiration
// DO
await jj.startTrajectory('implement: user password reset with email verification');
// DON'T
await jj.startTrajectory('task1');
// DO - Record meaningful operations
await jj.addToTrajectory(id, { action: 'create_migration', ... });
await jj.addToTrajectory(id, { action: 'update_schema', ... });
await jj.addToTrajectory(id, { action: 'run_migration', ... });
// DON'T - Skip steps or over-record
await jj.addToTrajectory(id, { action: 'thinking', ... }); // Too granular
// Score based on outcome
await jj.finalizeTrajectory(id,
testsPass && noRegressions ? 0.95 : 0.6,
critique
);
// Before starting new work, check for similar past work
const similar = await jj.queryTrajectories(newTask, 3);
if (similar.length > 0 && similar[0].similarity > 0.8) {
// Follow the successful pattern
const pattern = similar[0].operations;
}
For sensitive workflows, enable encryption:
await jj.enableEncryption();
// Trajectories are now encrypted with HQC-128
const id = await jj.startTrajectory('sensitive: handle PII data');
/agentic-flow learning - View learning statsagent-coordination - Multi-agent coordinationquantum-signing - Operation integritydocs/JJ-INTEGRATION.md - Full API referenceUse when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.