Skip to main content
Posthook helps your team understand how AI coding agents contribute to your codebase. It connects agent sessions, prompts, and code changes to Git commits, powering line-level attribution and session insights in Bilanc. This page explains what Posthook captures, where it is stored, and how you manage syncing and access. Data flows through three paths:

Capture scope

Posthook installs hooks in the detected agents’ user-level configuration and places a Git shadow ahead of the real git executable on PATH. On laptops, supported agents are Claude Code, Cursor, and Codex CLI. Cloud agents, including Devin, use their own hook configuration. Hooks capture agent activity across the user’s workspaces, independently of which repositories are connected to Bilanc. The Git shadow records commits without per-repository setup. Available events and fields depend on the agent, its version, and which hooks fire. Posthook also reads edited files locally to compute line ranges and supported agents’ local transcripts to extract prompts, model information, session times, and token usage.

Data inventory

The following records are stored locally and, in the default Full sync mode, included in team sync when enabled. In Metadata only mode the hook payload, prompt text, and commit message stay on the machine; see What team sync sends. Identifiers and timestamps accompany records to link sessions, events, repositories, and commits. Fields unavailable from an agent or Git may be empty.

Agent-hook content

Agent hooks provide the context behind each session and code change. Prompts and hook payloads are stored locally as supplied, without redaction. In Full sync mode they are included in team sync; in Metadata only mode they never leave the machine (see What team sync sends). Depending on the hook, this includes:
  • Tool names, inputs, and responses supplied by the agent.
  • Source-code fragments such as an edit’s old_string and new_string, patches, or the complete content passed to a file-write tool.
  • Shell commands and any outputs present in the payload.
  • Prompt text, local transcript paths, and other agent-specific metadata.
  • The final assistant reply in last_assistant_message when supplied by a Stop hook. Bilanc uses this to display assistant replies alongside user prompts.
Posthook reads files locally for attribution rather than uploading a repository snapshot. Source-code content supplied in prompts and tool payloads is part of the captured records. Transcript extraction supplies the prompts and session metadata described above; the available conversation content varies by agent.

What team sync sends

Team sync has two modes. A Bilanc Owner or Manager chooses one under Data sent to Bilanc in Admin → Connections → AI Tools → PostHook. The setting applies to the whole organization and can be changed at any time. Metadata only is an allowlist, not a denylist: anything not named in internal/sync/redact.go is dropped, and redact_test.go feeds every known content field through it and asserts that nothing survives. Bilanc applies the same allowlist again when a batch arrives from an organization set to Metadata only, so an out-of-date client cannot widen what is stored.

How the setting reaches each machine

  • New installs via the install link start in the organization’s current mode. The link does not need to be regenerated after a change.
  • Machines already syncing on posthook 0.5.0 or later switch on their next sync. Bilanc reports the organization’s mode in its reply to every upload, and a machine still in Full mode writes metadata_only to its config.json and redacts from then on.
  • Machines on older releases keep sending full data until they update with posthook update or by re-running the install link. Bilanc strips the content from those batches on arrival, but it has left the machine, so update them before relying on the mode.
  • Bilanc can only tighten a machine, never widen it. Moving an organization back to Full means running posthook sync --set-sync-mode full on each machine; a running sync daemon follows that on its next flush.

Verify on a machine

The local database is untouched by either mode, so posthook dash, posthook blame, and the local session timeline keep their full detail. File paths are sent in both modes and include the home-directory username. A machine can also be set directly with posthook sync --set-sync-mode full|metadata_only or the POSTHOOK_CLOUD_SYNC_MODE environment variable; an unrecognized value pauses uploads rather than falling back to Full.

Where data is stored

On the machine

  • ~/.posthook/posthook.db is the local SQLite database.
  • ~/.posthook/spool/ temporarily holds raw hook payloads before the worker ingests them. Successfully processed records are removed from the spool; failed records can remain for retry.
  • ~/.posthook/config.json holds cloud-sync settings including the sync mode, the team install token, and configured engineer identity. The configuration writer uses owner-only file permissions (0600). Runtime environment variables can supply or override these settings instead.
  • Each tracked repository can contain attribution metadata under refs/notes/posthook.
In a cloud-agent setup, these locations are on the agent vendor’s session machine rather than the engineer’s laptop.

In Bilanc

Team sync sends pending records as JSON to POST /posthook/ingest. The standard hosted endpoint is https://api.bilanc.co/posthook/ingest, using HTTPS and a Bearer install token. For a self-hosted deployment, configure your own HTTPS endpoint. Bilanc stores each received batch in PostgreSQL, associated with the organization identified by the validated install key. For organizations set to Metadata only, the ingestion API applies the same allowlist to every batch before storing it. These records power session, message, file, commit, and aggregate views in your workspace; where prompt text was withheld, the session viewer shows that a prompt was sent and its length. Sync retains your local records and uploads pending records, including those captured before sync was enabled or while it was paused.

In your Git remote

Git-note sharing lets attribution travel with your repository, independently of Bilanc team sync and without an install key. Notes contain the commit SHA, repository-relative file paths, line ranges, agent, model, session ID, and event timestamps. Posthook-generated notes contain attribution metadata rather than prompt text or source-code snippets. The Git shadow pushes these notes after a successful git push and fetches/merges them during relevant Git operations. Notes follow your repository host’s access and retention controls and are available to clones that fetch them. Git-note sharing is enabled by default, including when Bilanc team sync is off, and can be managed separately as described below.

Authentication and access

  • A Bilanc Owner or Manager can create, list, and revoke team install keys.
  • An install key is organization-scoped and write-only for Posthook ingestion. It does not grant access to Bilanc’s user or metrics read APIs. The ingestion service derives the destination organization from the key, not a tenant supplied in the payload.
  • Engineers do not need Bilanc accounts to send records with an install key. Engineer names and emails are attribution metadata supplied by the client, not individual authentication credentials.
  • Dashboard and metrics access uses Bilanc user authentication and permissions, separately from the install key. See user management and Posthook metrics for the documented role and data-access model.
Store install links and tokens in your organization’s secrets-management system. One key can serve multiple machines in your organization, and revoking it stops future authorized uploads from all machines using that key.

Manage syncing

Pause Bilanc uploads

The running sync loop applies this setting on subsequent cycles; an upload already in progress can finish. If the service or hook environment enables sync through POSTHOOK_CLOUD_ENABLED, remove that override or set it to false too. Environment settings take precedence over the configuration file. Local capture continues while uploads are paused, and pending records sync when uploads resume. Existing local and hosted records remain in place. You can also revoke an install key to stop future authorized uploads using that key.

Disable automatic Git-note sharing

Set this in the environment used by Git invocations, including cloud-agent sessions where applicable. It turns off the Git shadow’s explicit note fetch/merge operations and automatic note pushes. Local note creation continues, and existing notes remain in remotes and clones. You can still share notes through explicit Git commands. Git also uses persistent fetch settings to download notes during ordinary fetches. To turn off these downloads, remove Posthook’s +refs/notes/posthook*:refs/notes/posthook-remote* value from each affected repository’s remote.<name>.fetch entries. Older installations may use +refs/notes/posthook:refs/notes/posthook-remote or refs/notes/posthook:refs/notes/posthook; remove those note-fetch entries too, keeping normal branch fetch entries. Installation and posthook notes configure can restore these settings even when POSTHOOK_NOTES_SYNC=0; the fallback post-commit hook also runs that configuration command.

Data management

For retention information or a hosted data-deletion request, contact Bilanc about your deployment. Local records and Git notes are managed separately on your machines and repository host.

Implementation reference

Posthook is open source. This inventory reflects collector revision 017b1c8: local schema, capture, and sync. The metadata-only allowlist is internal/sync/redact.go as of release v0.5.0. Run posthook version to see your installed version.