Skip to content

Overview

contox_add_entry adds a new entry to a journal-like context. Entries are INSERT-only (event-sourced) — they can never be modified or deleted after creation. This makes journal contexts an append-only log.

Entries use client-generated ULIDs for monotone ordering, ensuring entries are always sorted chronologically even when created in parallel.

Idempotency is supported via the optional idempotencyKey parameter, which prevents duplicate entries when retrying a failed request.

Parameters

NameTypeRequiredDefaultDescription
contextIdstringYesTarget context ID to add the entry to
titlestringYesEntry title (max 200 characters)
contentstringYesEntry content in markdown
entryTypestringNoEntry type (e.g., "bug-fix", "feature", "session")
tagsstring[]NoTags for categorization
idempotencyKeystringNoIdempotency key for retry safety
sourcestringNoSource identifier
sourceRefstringNoSource reference (commit SHA, session ID, etc.)

Return value

Returns a confirmation message with the entry title and ID:

Entry added: Fixed auth race condition (entry_xyz789)

Usage examples

Adding a bug fix entry

Claude calls: contox_add_entry({
  contextId: "ctx_bugs123",
  title: "Fixed auth race condition",
  content: "The refresh token endpoint was called multiple times in parallel. Added mutex lock in `src/lib/auth-client.ts`.",
  entryType: "bug-fix",
  tags: ["auth", "race-condition"],
  sourceRef: "abc123def"
})

Adding an implementation entry with idempotency

Claude calls: contox_add_entry({
  contextId: "ctx_impl456",
  title: "Added dark mode toggle",
  content: "Implemented dark mode toggle in settings page using CSS custom properties and localStorage persistence.",
  entryType: "feature",
  tags: ["ui", "dark-mode"],
  idempotencyKey: "session-42-dark-mode"
})

Notes

  • Entries are immutable once created. To correct information, add a new entry with the correction.
  • The idempotencyKey prevents duplicates — if an entry with the same key already exists, the operation is a no-op.
  • Journal contexts can accumulate many entries over time. Use contox_compact to summarize old entries and reduce token count.
  • The sourceRef field is used by contox_git_digest to track the last processed commit SHA for incremental digests.