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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@ This creates a `.tracevault/` directory and installs a pre-push hook. The hook r
```sh
tracevault sync # sync repo metadata with server
tracevault check # evaluate policies against server rules (blocks push on failure)
tracevault push # upload traces to server
```

Session and commit data is streamed to the server continuously via the Claude Code hooks (`tracevault stream`) and the git post-commit hook (`tracevault commit-push`), so there is no separate upload step.

The command also installs the Claude Code hook configuration in `.claude/settings.json`. Each hook runs `tracevault stream --event <type>`, which records the event locally and pushes it to the server in real time:

```json
Expand Down Expand Up @@ -228,7 +229,7 @@ The command also installs the Claude Code hook configuration in `.claude/setting
}
```

### 7. Authenticate and push traces
### 7. Authenticate

```sh
# Log in to a TraceVault server.
Expand All @@ -238,12 +239,12 @@ The command also installs the Claude Code hook configuration in `.claude/setting
# force that behaviour with `--no-browser` or `TRACEVAULT_NO_BROWSER=1`.
tracevault login --server-url https://your-server.example.com

# Push traces to the server:
tracevault push

# Check policies before pushing (also runs automatically via pre-push hook):
tracevault check

# Retry any events that failed to stream in real time (network blip, server down):
tracevault flush

# View local session stats:
tracevault stats

Expand Down Expand Up @@ -277,7 +278,7 @@ tracevault login --server-url https://your-tracevault-server.example.com
tracevault init
```

That's it. From this point on, every Claude Code session in this repo is automatically traced — tool calls, file edits, token usage, and model info are captured and streamed to the TraceVault server. When you `git push`, the pre-push hook evaluates policies and uploads traces.
That's it. From this point on, every Claude Code session in this repo is automatically traced — tool calls, file edits, token usage, and model info are captured and streamed to the TraceVault server as they happen. When you `git push`, the pre-push hook evaluates policies and blocks the push if any rule fails.

## Keys & Secrets

Expand Down Expand Up @@ -337,7 +338,6 @@ export DATABASE_URL=postgres://user:password@host:5432/tracevault?sslmode=requir
| `tracevault stream --event <type>` | Handle a Claude Code hook event (reads JSON from stdin) and stream it to the server |
| `tracevault sync` | Sync repo metadata with the server |
| `tracevault check` | Evaluate policies against server rules, exit non-zero if blocked |
| `tracevault push` | Push collected traces to the server |
| `tracevault stats` | Show local session statistics |
| `tracevault verify` | Verify commits are registered and sealed on the server (`--commits` or `--range`) |
| `tracevault status` | Show current session status (not yet implemented) |
Expand Down
4 changes: 2 additions & 2 deletions crates/tracevault-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ cargo install tracevault-cli
```sh
tracevault init # Initialize in a repo
tracevault status # Show tracing status
tracevault check # Run attribution checks
tracevault push # Push traces to server
tracevault check # Evaluate policies before push
tracevault flush # Retry any events that failed to stream live
```

## License
Expand Down
60 changes: 0 additions & 60 deletions crates/tracevault-cli/src/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,6 @@ pub struct ApiClient {
client: reqwest::Client,
}

#[derive(Serialize)]
pub struct PushTraceRequest {
pub repo_name: String,
pub commit_sha: String,
pub branch: Option<String>,
pub author: String,
pub model: Option<String>,
pub tool: Option<String>,
pub session_id: Option<String>,
pub total_tokens: Option<i64>,
pub input_tokens: Option<i64>,
pub output_tokens: Option<i64>,
pub estimated_cost_usd: Option<f64>,
pub api_calls: Option<i32>,
pub session_data: Option<serde_json::Value>,
pub transcript: Option<serde_json::Value>,
pub diff_data: Option<serde_json::Value>,
pub model_usage: Option<serde_json::Value>,
pub duration_ms: Option<i64>,
pub started_at: Option<String>,
pub ended_at: Option<String>,
pub user_messages: Option<i32>,
pub assistant_messages: Option<i32>,
pub tool_calls: Option<serde_json::Value>,
pub total_tool_calls: Option<i32>,
pub cache_read_tokens: Option<i64>,
pub cache_write_tokens: Option<i64>,
pub compactions: Option<i32>,
pub compaction_tokens_saved: Option<i64>,
}

#[derive(Deserialize)]
pub struct PushTraceResponse {
pub commit_id: uuid::Uuid,
}

#[derive(Serialize)]
pub struct RegisterRepoRequest {
pub repo_name: String,
Expand Down Expand Up @@ -180,30 +144,6 @@ impl ApiClient {
}
}

pub async fn push_trace(
&self,
org_slug: &str,
req: PushTraceRequest,
) -> Result<PushTraceResponse, Box<dyn Error>> {
let mut builder = self
.client
.post(format!("{}/api/v1/orgs/{}/traces", self.base_url, org_slug));

if let Some(key) = &self.api_key {
builder = builder.header("Authorization", format!("Bearer {key}"));
}

let resp = builder.json(&req).send().await?;

if !resp.status().is_success() {
let status = resp.status();
let body = resp.text().await.unwrap_or_default();
return Err(format!("Server returned {status}: {body}").into());
}

Ok(resp.json().await?)
}

pub async fn register_repo(
&self,
org_slug: &str,
Expand Down
1 change: 0 additions & 1 deletion crates/tracevault-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub mod flush;
pub mod init;
pub mod login;
pub mod logout;
pub mod push;
pub mod stats;
pub mod status;
pub mod stream;
Expand Down
Loading
Loading