agent-trajectories 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,6 +124,35 @@ trail list --search "auth"
124
124
  # Export for documentation (markdown, json, timeline, or html)
125
125
  trail export traj_abc123 --format markdown
126
126
  trail export --format html --open # Opens in browser
127
+
128
+ # Compact trajectories (consolidate similar decisions)
129
+ trail compact # Uncompacted trajectories (default)
130
+ trail compact --branch main # Trajectories with commits not in main
131
+ trail compact --commits abc1234,def5678 # Trajectories matching specific commit SHAs
132
+ trail compact --pr 123 # Trajectories mentioning PR #123
133
+ trail compact --since 7d # Last 7 days
134
+ trail compact --all # Everything (including previously compacted)
135
+ ```
136
+
137
+ ### Automatic Compaction (GitHub Action)
138
+
139
+ Add these steps to any workflow that runs on PR merge (e.g., your release or publish flow). Requires `ref: ${{ github.event.pull_request.base.ref }}` and `fetch-depth: 0` on checkout, plus `contents: write` permission:
140
+
141
+ ```yaml
142
+ - name: Compact trajectories
143
+ run: |
144
+ PR_COMMITS=$(git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --format=%H | paste -sd, -)
145
+ OUTPUT=".trajectories/compacted/pr-${{ github.event.pull_request.number }}.json"
146
+ if [ -n "$PR_COMMITS" ]; then
147
+ npx agent-trajectories compact --commits "$PR_COMMITS" --output "$OUTPUT"
148
+ else
149
+ npx agent-trajectories compact --pr ${{ github.event.pull_request.number }} --output "$OUTPUT"
150
+ fi
151
+ - name: Commit compacted trajectories
152
+ run: |
153
+ git add .trajectories/compacted/ || true
154
+ git diff --cached --quiet || \
155
+ (git commit -m "chore: compact trajectories for PR #${{ github.event.pull_request.number }}" && git push)
127
156
  ```
128
157
 
129
158
  ### SDK