Skip to content

feat(code): add Hooks v2 session transcripts - #4918

Merged
Johannes du Plessis (johannes117) merged 19 commits into
mainfrom
johannes117/code/dcd-70-hooks-transcripts
Jul 23, 2026
Merged

feat(code): add Hooks v2 session transcripts#4918
Johannes du Plessis (johannes117) merged 19 commits into
mainfrom
johannes117/code/dcd-70-hooks-transcripts

Conversation

@johannes117

@johannes117 Johannes du Plessis (johannes117) commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Depends on #4917
Closes DCD-70

Hooks v2 now materializes private versioned transcript projections and exposes them through a session-scoped client runtime.


This is 3/3 in the DCD-70 stack.

  • Adds deterministic per-thread and subagent JSONL projections with redaction, path-safe identities, private permissions, atomic writes, revisions, and retention.
  • Adds a client-owned runtime that freezes one snapshot and materializes real transcript paths immediately before command execution.
  • Keeps lifecycle call-site and server/client dispatch wiring out of scope for the following tickets.
Test plan
  • uv run --group test pytest tests/unit_tests/hooks — 101 passed
  • make lint
  • make check_imports

Stack generated by Git Town

@github-actions github-actions Bot added dcode Related to `deepagents-code` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: L 500-999 LOC labels Jul 21, 2026

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/hooks/transcript.py Outdated
Freeze validated hook configuration into deterministic session snapshots backed by one event capability registry.
Apply event-aware output policies and isolate command handlers with sanitized environments, bounded terminal output, and process-group cleanup.
Materialize private versioned transcript projections and expose them through a session-scoped client runtime.
Johannes du Plessis (johannes117) added a commit that referenced this pull request Jul 22, 2026
Related DCD-70

Hooks v2 now validates and freezes configuration into deterministic
session snapshots backed by one authoritative event capability registry.

---

This is 1/3 in the DCD-70 stack.

- Defines event ownership, matching, timeout, output, and aggregation
capabilities.
- Loads project and user configuration in stable precedence order with
semantic-only legacy migration.
- Computes canonical snapshot hashes and rejects unsupported matcher or
handler combinations before execution.

<details>
<summary>Test plan</summary>

- `uv run --group test pytest tests/unit_tests/hooks` — 81 passed at
this stack layer
- `make lint`

</details>

<!-- branch-stack-start -->

-------------------------
- main
  - **johannes117/code/dcd-70-hooks-capabilities** 👈
-
[johannes117/code/dcd-70-hooks-execution](#4917)
-
[johannes117/code/dcd-70-hooks-transcripts](#4918)

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->
Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts:
#	libs/code/deepagents_code/hooks/snapshot.py
#	libs/code/tests/unit_tests/hooks/models/test_models.py
Comment thread libs/code/deepagents_code/hooks/transcript.py
Comment thread libs/code/deepagents_code/hooks/runtime.py
Comment thread libs/code/deepagents_code/hooks/runtime.py
Comment thread libs/code/deepagents_code/hooks/runtime.py Outdated
Johannes du Plessis (johannes117) added a commit that referenced this pull request Jul 23, 2026
Depends on #4916
Related DCD-70

Hooks v2 command handlers now execute with event-aware policies, bounded
terminal output, sanitized environments, and complete process cleanup.

---

This is 2/3 in the DCD-70 stack.

- Applies plain-output, exit-code, continuation, permission, and
deferred-field policies without discarding sibling diagnostics.
- Validates terminal sequences and removes ambient secret and telemetry
environment values.
- Cleans up complete process groups on timeout or cancellation and maps
native/MCP tool calls only from trustworthy metadata.
- Keeps materialized filesystem paths outside domain and transport
state.

<details>
<summary>Test plan</summary>

- `uv run --group test pytest tests/unit_tests/hooks` — 95 passed at
this stack layer
- `make lint`

</details>

<!-- branch-stack-start -->

-------------------------
- main
  - **fix(code): harden Hooks v2 command execution** 👈
    - #4918
      - #4971

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->
Base automatically changed from johannes117/code/dcd-70-hooks-execution to main July 23, 2026 00:39

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

@johannes117
Johannes du Plessis (johannes117) merged commit ca86fbe into main Jul 23, 2026
54 checks passed
@johannes117
Johannes du Plessis (johannes117) deleted the johannes117/code/dcd-70-hooks-transcripts branch July 23, 2026 17:57
Mason Daugherty (mdrxy) pushed a commit that referenced this pull request Jul 24, 2026
> [!CAUTION]
> Merging this PR will automatically publish to **PyPI** and create a
**GitHub release**.

For the full release process, see
[`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md).

---

_Release notes preview: keep this section in sync with the package
`CHANGELOG.md`. The published GitHub release body is extracted from the
merged `CHANGELOG.md` by `release.yml`, not from this PR description._

---


##
[0.1.46](deepagents-code==0.1.45...deepagents-code==0.1.46)
(2026-07-24)

### Highlights

- Auto mode is now generally available.
[#4957](#4957)
- Added configurable Auto goal-criteria acceptance.
[#4940](#4940)
- Improved Auto behavior by authorizing actions from active goal/rubric
directives, avoiding redundant approval prompts, showing the enable
notice only on first global enable, deduplicating classifier-unavailable
transcript spam, logging underlying classifier failures, and reporting
classifier timeout budgets.
[#5017](#5017)
[#4993](#4993)
[#5012](#5012)
[#5013](#5013)
[#5011](#5011)
[#5025](#5025)
- Added Hooks v2 capability snapshots and session transcripts, and
hardened Hooks v2 command execution.
[#4916](#4916)
[#4918](#4918)
[#4917](#4917)
- Raised the agent recursion limit to 2000 and made it configurable.
[#4994](#4994)

### Improvements and fixes

- Let the rubric grader inspect working-directory files, show rubric
grader defaults, and improved `/rubric` help and empty-state messaging.
[#4835](#4835)
[#4966](#4966)
[#5015](#5015)
- Unified goal activation signaling.
[#4980](#4980)
- Made Version, Model, and CWD copyable in the Debug Console.
[#4975](#4975)
- Improved `config get` output when a key is missing.
[#4976](#4976)
- Aborted YOLO launch on `Ctrl+C`/`Ctrl+D` and made the YOLO warning
friendlier for new users.
[#4953](#4953)
[#4950](#4950)
- Updated LangSmith handling: secret redaction is disabled by default,
`/trace` now flags empty env overrides that shadow the LangSmith key,
and the default US endpoint is no longer treated as a custom target.
[#4970](#4970)
[#4996](#4996)
[#5022](#5022)
- Injected OpenAI `prompt_cache_key` for any OpenAI-provider endpoint.
[#4995](#4995)
- Improved tool and schema presentation: finished calls stay on the live
tool-group line, first-party tool schemas now include field
descriptions, and `web_search`/`fetch_url` tool descriptions were
trimmed. [#4927](#4927)
[#5019](#5019)
[#5016](#5016)
- Omitted `plugins/` and `conversation_history/` from the `/agent`
picker. [#4991](#4991)
- Made selector modal backdrop dimming consistent.
[#4990](#4990)
- Restored the `"Server log preserved at:"` notice on exit.
[#4999](#4999)
- Used the SDK pin as the effective editable version.
[#4949](#4949)

_End release notes preview._

---

> [!NOTE]
> A **New Contributors** section is appended to the GitHub release notes
automatically at publish time (see [Release
Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline),
step 2).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
Johannes du Plessis (johannes117) added a commit that referenced this pull request Jul 24, 2026
Depends on #4918

Legacy hooks with prompt, compaction, turn-completion, notification, and
session-end subscriptions now migrate into typed Hooks v2 events while
retaining their side-effect-only behavior.

---

This adds typed `UserPromptSubmit` and `PreCompact` domain, wire,
capability, projection, matching, and reduction support. The migration
consolidates legacy aliases, preserves the five-second timeout, and
neutralizes stdout and exit status so observational legacy commands
cannot unexpectedly block Hooks v2 lifecycle actions.

Legacy tool and permission events remain unmapped because their
fire-and-forget, batched, and failure semantics are not equivalent to
the current Hooks v2 lifecycle events.

<!-- branch-stack-start -->

-------------------------
- main
  - #4917
    - #4918
      - **feat(code): migrate legacy hooks to v2 events** 👈

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Related DCD-70

Hooks v2 now validates and freezes configuration into deterministic
session snapshots backed by one authoritative event capability registry.

---

This is 1/3 in the DCD-70 stack.

- Defines event ownership, matching, timeout, output, and aggregation
capabilities.
- Loads project and user configuration in stable precedence order with
semantic-only legacy migration.
- Computes canonical snapshot hashes and rejects unsupported matcher or
handler combinations before execution.

<details>
<summary>Test plan</summary>

- `uv run --group test pytest tests/unit_tests/hooks` — 81 passed at
this stack layer
- `make lint`

</details>

<!-- branch-stack-start -->

-------------------------
- main
  - **johannes117/code/dcd-70-hooks-capabilities** 👈
-
[johannes117/code/dcd-70-hooks-execution](langchain-ai#4917)
-
[johannes117/code/dcd-70-hooks-transcripts](langchain-ai#4918)

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Depends on langchain-ai#4916
Related DCD-70

Hooks v2 command handlers now execute with event-aware policies, bounded
terminal output, sanitized environments, and complete process cleanup.

---

This is 2/3 in the DCD-70 stack.

- Applies plain-output, exit-code, continuation, permission, and
deferred-field policies without discarding sibling diagnostics.
- Validates terminal sequences and removes ambient secret and telemetry
environment values.
- Cleans up complete process groups on timeout or cancellation and maps
native/MCP tool calls only from trustworthy metadata.
- Keeps materialized filesystem paths outside domain and transport
state.

<details>
<summary>Test plan</summary>

- `uv run --group test pytest tests/unit_tests/hooks` — 95 passed at
this stack layer
- `make lint`

</details>

<!-- branch-stack-start -->

-------------------------
- main
  - **fix(code): harden Hooks v2 command execution** 👈
    - langchain-ai#4918
      - langchain-ai#4971

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Depends on langchain-ai#4917
Closes DCD-70

Hooks v2 now materializes private versioned transcript projections and
exposes them through a session-scoped client runtime.

---

This is 3/3 in the DCD-70 stack.

- Adds deterministic per-thread and subagent JSONL projections with
redaction, path-safe identities, private permissions, atomic writes,
revisions, and retention.
- Adds a client-owned runtime that freezes one snapshot and materializes
real transcript paths immediately before command execution.
- Keeps lifecycle call-site and server/client dispatch wiring out of
scope for the following tickets.

<details>
<summary>Test plan</summary>

- `uv run --group test pytest tests/unit_tests/hooks` — 101 passed
- `make lint`
- `make check_imports`

</details>

<!-- branch-stack-start -->

-------------------------
- main
  - langchain-ai#4917
    - **feat(code): add Hooks v2 session transcripts** 👈
      - langchain-ai#4971

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
> [!CAUTION]
> Merging this PR will automatically publish to **PyPI** and create a
**GitHub release**.

For the full release process, see
[`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md).

---

_Release notes preview: keep this section in sync with the package
`CHANGELOG.md`. The published GitHub release body is extracted from the
merged `CHANGELOG.md` by `release.yml`, not from this PR description._

---


##
[0.1.46](langchain-ai/deepagents@deepagents-code==0.1.45...deepagents-code==0.1.46)
(2026-07-24)

### Highlights

- Auto mode is now generally available.
[langchain-ai#4957](langchain-ai#4957)
- Added configurable Auto goal-criteria acceptance.
[langchain-ai#4940](langchain-ai#4940)
- Improved Auto behavior by authorizing actions from active goal/rubric
directives, avoiding redundant approval prompts, showing the enable
notice only on first global enable, deduplicating classifier-unavailable
transcript spam, logging underlying classifier failures, and reporting
classifier timeout budgets.
[langchain-ai#5017](langchain-ai#5017)
[langchain-ai#4993](langchain-ai#4993)
[langchain-ai#5012](langchain-ai#5012)
[langchain-ai#5013](langchain-ai#5013)
[langchain-ai#5011](langchain-ai#5011)
[langchain-ai#5025](langchain-ai#5025)
- Added Hooks v2 capability snapshots and session transcripts, and
hardened Hooks v2 command execution.
[langchain-ai#4916](langchain-ai#4916)
[langchain-ai#4918](langchain-ai#4918)
[langchain-ai#4917](langchain-ai#4917)
- Raised the agent recursion limit to 2000 and made it configurable.
[langchain-ai#4994](langchain-ai#4994)

### Improvements and fixes

- Let the rubric grader inspect working-directory files, show rubric
grader defaults, and improved `/rubric` help and empty-state messaging.
[langchain-ai#4835](langchain-ai#4835)
[langchain-ai#4966](langchain-ai#4966)
[langchain-ai#5015](langchain-ai#5015)
- Unified goal activation signaling.
[langchain-ai#4980](langchain-ai#4980)
- Made Version, Model, and CWD copyable in the Debug Console.
[langchain-ai#4975](langchain-ai#4975)
- Improved `config get` output when a key is missing.
[langchain-ai#4976](langchain-ai#4976)
- Aborted YOLO launch on `Ctrl+C`/`Ctrl+D` and made the YOLO warning
friendlier for new users.
[langchain-ai#4953](langchain-ai#4953)
[langchain-ai#4950](langchain-ai#4950)
- Updated LangSmith handling: secret redaction is disabled by default,
`/trace` now flags empty env overrides that shadow the LangSmith key,
and the default US endpoint is no longer treated as a custom target.
[langchain-ai#4970](langchain-ai#4970)
[langchain-ai#4996](langchain-ai#4996)
[langchain-ai#5022](langchain-ai#5022)
- Injected OpenAI `prompt_cache_key` for any OpenAI-provider endpoint.
[langchain-ai#4995](langchain-ai#4995)
- Improved tool and schema presentation: finished calls stay on the live
tool-group line, first-party tool schemas now include field
descriptions, and `web_search`/`fetch_url` tool descriptions were
trimmed. [langchain-ai#4927](langchain-ai#4927)
[langchain-ai#5019](langchain-ai#5019)
[langchain-ai#5016](langchain-ai#5016)
- Omitted `plugins/` and `conversation_history/` from the `/agent`
picker. [langchain-ai#4991](langchain-ai#4991)
- Made selector modal backdrop dimming consistent.
[langchain-ai#4990](langchain-ai#4990)
- Restored the `"Server log preserved at:"` notice on exit.
[langchain-ai#4999](langchain-ai#4999)
- Used the SDK pin as the effective editable version.
[langchain-ai#4949](langchain-ai#4949)

_End release notes preview._

---

> [!NOTE]
> A **New Contributors** section is appended to the GitHub release notes
automatically at publish time (see [Release
Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline),
step 2).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Depends on langchain-ai#4918

Legacy hooks with prompt, compaction, turn-completion, notification, and
session-end subscriptions now migrate into typed Hooks v2 events while
retaining their side-effect-only behavior.

---

This adds typed `UserPromptSubmit` and `PreCompact` domain, wire,
capability, projection, matching, and reduction support. The migration
consolidates legacy aliases, preserves the five-second timeout, and
neutralizes stdout and exit status so observational legacy commands
cannot unexpectedly block Hooks v2 lifecycle actions.

Legacy tool and permission events remain unmapped because their
fire-and-forget, batched, and failure semantics are not equivalent to
the current Hooks v2 lifecycle events.

<!-- branch-stack-start -->

-------------------------
- main
  - langchain-ai#4917
    - langchain-ai#4918
      - **feat(code): migrate legacy hooks to v2 events** 👈

<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>

<!-- branch-stack-end -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dcode Related to `deepagents-code` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: L 500-999 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants