Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ npm-debug.log*
# Trajectories - don't commit active work
.relay
trail-viewer/.build
.agentworkforce/trajectories/active/
.trajectories/active/
.agent-relay/
670 changes: 0 additions & 670 deletions .trajectories/index.json

This file was deleted.

2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ trail complete --summary "Added JWT auth with refresh tokens" --confidence 0.85

After completing work, compact the finished trajectory or merged PR into a
durable summary. When the compacted summary is sufficient, discard the raw
source trajectories so `.trajectories/index.json` and list output stay focused:
source trajectories so `.agentworkforce/trajectories/index.json` and list output stay focused:

```bash
trail compact --discard-sources
Expand Down
10 changes: 5 additions & 5 deletions IMPLEMENTATION-PROPOSAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ What does using agent-trajectories look like day-to-day?
│ └───────────────────────────────────────────────────────────────┘ │
│ │
│ ✓ Trajectory completed │
│ ✓ Exported to .trajectories/traj_a1b2c3.json │
│ ✓ Summary written to .trajectories/traj_a1b2c3.md │
│ ✓ Exported to .agentworkforce/trajectories/traj_a1b2c3.json │
│ ✓ Summary written to .agentworkforce/trajectories/traj_a1b2c3.md │
└──────────────────────────────────────────────────────────────────────┘
Expand Down Expand Up @@ -618,7 +618,7 @@ agent-trajectories/
### Option A: File System Only

```
.trajectories/
.agentworkforce/trajectories/
├── active/
│ └── traj_abc123/
│ └── trajectory.json
Expand Down Expand Up @@ -687,7 +687,7 @@ CREATE VIRTUAL TABLE trajectories_fts USING fts5(
### Option C: SQLite + Files (Hybrid)

```
.trajectories/
.agentworkforce/trajectories/
├── trajectories.db # SQLite index + search
├── data/
│ ├── traj_abc123.json # Full trajectory data
Expand Down Expand Up @@ -1305,7 +1305,7 @@ This is the recommended path—a progressive architecture that works for a solo
│ │
│ SOLO DEV (Day 1) │
│ ├── npm install agent-trajectories │
│ ├── File storage (.trajectories/ in repo) │
│ ├── File storage (.agentworkforce/trajectories/ in repo) │
│ ├── CLI: start, status, complete, export │
│ └── Zero config, works immediately │
│ │
Expand Down
10 changes: 5 additions & 5 deletions PROPOSAL-trajectories.md
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ project/
├── src/
├── .beads/
│ └── issues.jsonl
├── .trajectories/
├── .agentworkforce/trajectories/
│ ├── index.json # Index of all trajectories
│ ├── bd-123.json # Full trajectory
│ ├── bd-123.summary.md # Human-readable summary
Expand Down Expand Up @@ -1129,15 +1129,15 @@ Trajectories support multiple storage backends:

| Backend | Use Case | Notes |
|---------|----------|-------|
| **File system** | Default, git-friendly | `.trajectories/` in repo |
| **File system** | Default, git-friendly | `.agentworkforce/trajectories/` in repo |
| **SQLite** | Local indexing, search | Same DB as messages |
| **PostgreSQL** | Multi-user, cloud | Shared team access |
| **S3/GCS** | Archive, large teams | Cold storage for old trajectories |

### File System (Default)

```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language to the fenced code block at Line 1139.

Markdownlint MD040 is triggered here; please annotate this fence (e.g., ```text) to keep doc lint clean.

Suggested fix
-```
+```text
 .agentworkforce/trajectories/
 ├── index.json                    # Quick lookup index
 ...
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 1139-1139: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @PROPOSAL-trajectories.md at line 1139, Update the fenced code block showing
the directory tree for ".agentworkforce/trajectories/" by adding a language
identifier (e.g., text) to the opening fence so Markdownlint MD040 is satisfied; locate the fenced block that begins with the line ".agentworkforce/trajectories/" and change the opening to include the
language token (such as text) so the block becomes fenced with ```text.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

.trajectories/
.agentworkforce/trajectories/
├── index.json # Quick lookup index
├── active/ # In-progress trajectories
│ └── traj_abc123.json
Expand Down Expand Up @@ -1480,7 +1480,7 @@ git notes add -m "$(agent-relay trajectory export abc123 --format summary)" abc1

### Phase 1: Foundation
- Define trajectory JSON schema (v1)
- File-based storage (`.trajectories/` directory)
- File-based storage (`.agentworkforce/trajectories/` directory)
- CLI: `trajectory new`, `trajectory status`, `trajectory complete`
- Manual capture via `[[TRAJECTORY:*]]` blocks

Expand Down Expand Up @@ -1511,7 +1511,7 @@ git notes add -m "$(agent-relay trajectory export abc123 --format summary)" abc1

## Open Questions

1. **Storage location:** `.trajectories/` in repo vs external database?
1. **Storage location:** `.agentworkforce/trajectories/` in repo vs external database?
- In-repo: Versioned with code, but bloats repo
- External: Scalable, but requires infra

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A **trajectory** is the complete story of agent work on a task:
Works with any task system: Beads, Linear, Jira, GitHub Issues, or standalone. Trajectories are a universal format—like Markdown for documentation.

### Multiple Storage Backends
- **File system** (default) - `.trajectories/` directory, git-friendly
- **File system** (default) - `.agentworkforce/trajectories/` directory, git-friendly
- **SQLite** - Local indexing and search
- **PostgreSQL/S3** - For teams and archival

Expand Down Expand Up @@ -145,15 +145,15 @@ Use `--discard-sources` when the compacted summary should replace the raw source
- name: Compact trajectories
run: |
PR_COMMITS=$(git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --format=%H | paste -sd, -)
OUTPUT=".trajectories/compacted/pr-${{ github.event.pull_request.number }}.json"
OUTPUT=".agentworkforce/trajectories/compacted/pr-${{ github.event.pull_request.number }}.json"
if [ -n "$PR_COMMITS" ]; then
npx agent-trajectories compact --commits "$PR_COMMITS" --output "$OUTPUT" --discard-sources
else
npx agent-trajectories compact --pr ${{ github.event.pull_request.number }} --output "$OUTPUT" --discard-sources
fi
- name: Commit compacted trajectories
run: |
git add .trajectories/ || true
git add .agentworkforce/trajectories/ || true
git diff --cached --quiet || \
(git commit -m "chore: compact trajectories for PR #${{ github.event.pull_request.number }}" && git push)
```
Expand Down Expand Up @@ -463,7 +463,7 @@ The client manages trajectories with persistent storage.
```typescript
const client = new TrajectoryClient({
defaultAgent: 'my-agent', // Default agent name
dataDir: '.trajectories', // Storage directory
dataDir: '.', // Base directory; stores under .agentworkforce/trajectories
autoSave: true, // Auto-save after operations
});

Expand Down Expand Up @@ -542,7 +542,7 @@ const t = TrajectoryBuilder.create('Task')
This project is in early development. See [PROPOSAL-trajectories.md](./PROPOSAL-trajectories.md) for the full design document.

**v1.0 (current)**
- [x] File-based storage (`.trajectories/`)
- [x] File-based storage (`.agentworkforce/trajectories/`)
- [x] Core CLI commands (`start`, `decision`, `complete`, `list`, `show`, `export`)
- [x] Agent Trace spec compliance (`.trace.json` generation)
- [x] Multi-agent participation tracking
Expand Down
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
".openskills",
".claude",
".agent-relay",
".agentworkforce",
".trajectories"
]
}
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ Trajectory files should be created with restrictive permissions:

Recommend users add to `.gitignore`:
```
.trajectories/active/ # Don't commit in-progress work
.trajectories/**/*.env # Any env files
.agentworkforce/trajectories/active/ # Don't commit in-progress work
.agentworkforce/trajectories/**/*.env # Any env files
```

---
Expand Down Expand Up @@ -334,7 +334,7 @@ Warn users if trajectory exceeds reasonable size:
## Directory Structure

```
.trajectories/
.agentworkforce/trajectories/
├── active/ # In-progress trajectories
│ └── traj_abc123/
│ └── trajectory.json
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/memory-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Each AI coding tool maintains its own isolated context:
Trajectories and the workspace provide tool-agnostic project memory:

```
.trajectories/ # What happened (work history)
.agentworkforce/trajectories/ # What happened (work history)
├── active/ # Current work
└── completed/ # Past work with full reasoning

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/web-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A lightweight local web interface for humans to browse and read trajectories in
1. **Zero external dependencies** - No cloud services, runs entirely local
2. **Instant startup** - `traj view` opens browser immediately
3. **No build step** - Works without webpack/vite in dev
4. **Offline-first** - All data from local `.trajectories/`
4. **Offline-first** - All data from local `.agentworkforce/trajectories/`

## Architecture Options

Expand Down Expand Up @@ -207,7 +207,7 @@ workspace.query({

## Questions to Resolve

1. **Workspace location**: `.agent-workspace/` vs inside `.trajectories/workspace/`?
1. **Workspace location**: `.agent-workspace/` vs inside `.agentworkforce/trajectories/workspace/`?
2. **Knowledge format**: Markdown files vs JSON?
3. **Pattern templates**: How to make patterns executable/reusable?
4. **Multi-repo**: How does workspace work across repos?
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
"type": "git",
"url": "https://github.com/AgentWorkforce/trajectories"
},
"files": [
"dist"
],
"files": ["dist"],
"engines": {
"node": ">=20.0.0"
},
Expand Down
8 changes: 5 additions & 3 deletions scripts/benchmark-compaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Records a deliberately noisy trajectory (3 chapters, 5+ decisions, 10+
* findings, 15+ low-significance noise events) using the default
* TrajectoryClient storage (always `<cwd>/.trajectories/`). The caller is
* TrajectoryClient storage (always `<cwd>/.agentworkforce/trajectories/`). The caller is
* expected to `cd` into an isolated directory before invoking this script.
*
* Reads TRAJECTORIES_WORKFLOW_ID from the environment and forwards it to
Expand Down Expand Up @@ -69,7 +69,7 @@ async function main(): Promise<void> {
// ---------- Chapter 2: Implementation ----------
await session.chapter("Implementation", "benchmark-agent");
await session.finding(
"TrajectoryClient defaults storage to <cwd>/.trajectories",
"TrajectoryClient defaults storage to <cwd>/.agentworkforce/trajectories",
);
await session.finding("Session API is fully chainable and auto-saves");
await session.finding("addEvent accepts arbitrary significance levels");
Expand All @@ -80,7 +80,9 @@ async function main(): Promise<void> {
await session.event("thinking", "Will reuse default storage path", {
significance: "low",
});
await session.event("tool_call", "ls .trajectories", { significance: "low" });
await session.event("tool_call", "ls .agentworkforce/trajectories", {
significance: "low",
});
await session.event("tool_result", "active/ completed/", {
significance: "low",
});
Expand Down
9 changes: 7 additions & 2 deletions src/cli/commands/compact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import {
import { serializeForLLM } from "../../compact/serializer.js";
import { generateRandomId } from "../../core/id.js";
import type { Decision, Trajectory } from "../../core/types.js";
import { FileStorage, getSearchPaths } from "../../storage/file.js";
import {
FileStorage,
getDefaultTrajectoryDataDir,
getSearchPaths,
} from "../../storage/file.js";

/**
* A group of related decisions
Expand Down Expand Up @@ -840,7 +844,8 @@ function getDefaultOutputPath(
compacted: CompactedTrajectory,
workflowId?: string,
): string {
const trajDir = process.env.TRAJECTORIES_DATA_DIR || ".trajectories";
const trajDir =
process.env.TRAJECTORIES_DATA_DIR || getDefaultTrajectoryDataDir();
const compactedDir = join(trajDir, "compacted");

if (!existsSync(compactedDir)) {
Expand Down
7 changes: 5 additions & 2 deletions src/cli/commands/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
} from "../../core/trailers.js";
import { completeTrajectory } from "../../core/trajectory.js";
import type { TraceRecord, Trajectory } from "../../core/types.js";
import { FileStorage } from "../../storage/file.js";
import {
FileStorage,
getDefaultTrajectoryDataDir,
} from "../../storage/file.js";

/**
* Save trace file alongside the trajectory
Expand All @@ -24,7 +27,7 @@ async function saveTraceFile(
): Promise<void> {
// Determine trajectory file location based on status
const dataDir = process.env.TRAJECTORIES_DATA_DIR;
const baseDir = dataDir ? dataDir : join(process.cwd(), ".trajectories");
const baseDir = dataDir ? dataDir : getDefaultTrajectoryDataDir();
const completedDir = join(baseDir, "completed");

const date = new Date(trajectory.completedAt ?? trajectory.startedAt);
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Diagnose and (optionally) repair trajectory files that fail to load.
* Reconcile silently skips bad files so the CLI keeps working; doctor
* surfaces the path + first validation error for each one and can move
* them into `.trajectories/invalid/` so reconcile stops complaining.
* them into `.agentworkforce/trajectories/invalid/` so reconcile stops complaining.
*/

import type { Command } from "commander";
Expand All @@ -18,7 +18,7 @@ export function registerDoctorCommand(program: Command): void {
)
.option(
"--quarantine",
"Move invalid files to .trajectories/invalid/ so reconcile stops scanning them",
"Move invalid files to .agentworkforce/trajectories/invalid/ so reconcile stops scanning them",
)
.action(async (opts: { quarantine?: boolean }) => {
const storage = new FileStorage();
Expand All @@ -41,7 +41,7 @@ export function registerDoctorCommand(program: Command): void {

if (!opts.quarantine) {
console.log(
"\nRun `trail doctor --quarantine` to move these files into .trajectories/invalid/.",
"\nRun `trail doctor --quarantine` to move these files into .agentworkforce/trajectories/invalid/.",
);
return;
}
Expand Down
10 changes: 8 additions & 2 deletions src/cli/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import type { Command } from "commander";
import { exportToJSON } from "../../export/json.js";
import { exportToMarkdown } from "../../export/markdown.js";
import { exportToTimeline } from "../../export/timeline.js";
import { FileStorage } from "../../storage/file.js";
import {
FileStorage,
getDefaultTrajectoryDataDir,
} from "../../storage/file.js";
import { generateTrajectoryHtml } from "../../web/generator.js";

export function registerExportCommand(program: Command): void {
Expand Down Expand Up @@ -72,7 +75,10 @@ export function registerExportCommand(program: Command): void {
}
} else if (options.open && options.format === "html") {
// Write to temp location and open
const outputDir = join(process.cwd(), ".trajectories", "html");
const outputDir = join(
process.env.TRAJECTORIES_DATA_DIR ?? getDefaultTrajectoryDataDir(),
"html",
);
await mkdir(outputDir, { recursive: true });
const filePath = join(outputDir, `${trajectory.id}.html`);
await writeFile(filePath, output, "utf-8");
Expand Down
7 changes: 5 additions & 2 deletions src/compact/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { existsSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { getSearchPaths } from "../storage/file.js";
import {
getDefaultTrajectoryDataDir,
getSearchPaths,
} from "../storage/file.js";

export interface CompactionConfig {
provider: string;
Expand Down Expand Up @@ -88,7 +91,7 @@ function loadFileConfig(): Partial<CompactionConfig> {

function getPrimaryConfigDir(): string {
const searchPaths = getSearchPaths();
return searchPaths[0] ?? join(process.cwd(), ".trajectories");
return searchPaths[0] ?? getDefaultTrajectoryDataDir();
}

function readStringEnv(name: string): string | undefined {
Expand Down
2 changes: 1 addition & 1 deletion src/core/trailers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ if [ "$COMMIT_SOURCE" = "merge" ] || [ "$COMMIT_SOURCE" = "squash" ] || [ "$COMM
fi

# Find the trajectories data directory
TRAJ_DIR="\${TRAJECTORIES_DATA_DIR:-\$(git rev-parse --show-toplevel)/.trajectories}"
TRAJ_DIR="\${TRAJECTORIES_DATA_DIR:-\$(git rev-parse --show-toplevel)/.agentworkforce/trajectories}"
ACTIVE_DIR="$TRAJ_DIR/active"

# Check if there's an active trajectory
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export type {
} from "./core/types.js";

// Storage
export { FileStorage } from "./storage/file.js";
export {
DEFAULT_TRAJECTORY_DATA_DIR,
LEGACY_TRAJECTORY_DATA_DIR,
FileStorage,
getDefaultTrajectoryDataDir,
} from "./storage/file.js";
export type { StorageAdapter, StorageConfig } from "./storage/interface.js";

// Export
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export async function compactWorkflow(
export interface TrajectoryClientOptions {
/** Storage adapter to use. Defaults to FileStorage. */
storage?: StorageAdapter;
/** Base directory for file storage. Defaults to .trajectories */
/** Base directory for default file storage. Stores under .agentworkforce/trajectories. */
dataDir?: string;
/** Default agent name to use when not specified */
defaultAgent?: string;
Expand Down
Loading
Loading