Skip to content

feat: Phase 121 — HOTL session messaging + PreCompact auto-checkpoint - #267

Merged
Chachamaru127 merged 13 commits into
mainfrom
Chachamaru127/main
Jul 21, 2026
Merged

Chachamaru127 merged 13 commits into
mainfrom
Chachamaru127/main

Conversation

@Chachamaru127

@Chachamaru127 Chachamaru127 commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

What's Changed

Named, directed session messaging with a trust contract (HOTL), session labels/task declarations with reverse lookup, runtime identity for generated delivery hooks, and PreCompact auto-checkpoint instead of blocking.

Before / After

Before After
Sessions could only broadcast file-change notices; no way to tell one session something bin/harness inbox send --team <t> --from <id> --to <agent> "..." delivers at the recipient's turn boundary (Stop hook), silent when 0 unread
livemsg delivery path injected Subject/Body unsanitized Sanitize (control chars/ANSI) + non-instruction disclaimer + 4096B total / 768B per-message caps on read; sanitize on write too
No read-state visibility for senders inbox sent shows read flag + read_at
Generated Codex/Cursor delivery hooks ran with literal {{TEAM}}/{{AGENT}} (de-facto no-op) Generated commands use inbox check --from-env; identity resolves at runtime from env
session-list.sh showed only session ids; no way to find "who is working on task X" Presence cards carry {label, task, since}; harness session declare/list gives task→session reverse lookup (liveness stays filename+mtime only)
PreCompact blocked compaction whenever Plans.md had uncommitted edits Plans.md is auto-committed (pathspec-limited) and compaction proceeds; block remains only on commit failure or precompactAutoCommit: false

Added

  • livemsg trust contract + human send CLI (121.1): sanitize/disclaimer/caps on inbox check/monitor, new inbox send / inbox sent, additive Store.Sent
  • Delivery identity resolution (121.2): deliveryidentity.Resolve() (env → breezing fallback), placeholder-free generated hooks, golden fixtures updated
  • Claude host Stop delivery wiring (121.3): dual hooks.json (P29), zero-unread silence, e2e test, monitor stays opt-in OFF
  • Session labels + task declaration + team view (121.4): presence card JSON, harness session declare/list, session-list.sh as thin wrapper, auto-declare wired into harness-work/breezing skills

Changed

  • PreCompact auto-checkpoint (121.6): dirty Plans.md → pathspec-limited auto-commit + continue; fallback block preserved; config opt-out
  • Spec: Session Coordination Contract gains directed-message trust envelope, human-nudge authority boundary (approvals only on the target console), read_at semantics, presence-card contract
  • CLAUDE.md FACT-3 corrected: delivery generation has been wired since Phase 105.9 [b82143f]; stale "undeployed" note fixed (also in Plans.md preamble)

Verification

  • TDD: RED evidence captured per task (verbatim in worker reports); Lead independently re-ran tests per task
  • cd go && go test ./... -count=1 PASS on merged trunk; gofmt clean
  • scripts/ci/check-consistency.sh all green; tests/validate-plugin.sh 127 passed / 0 failed; branch-alignment ledger OK
  • Runtime smoke with rebuilt binaries: send → turn-boundary delivery (with disclaimer) → read → sent shows read_at; session declare 121.5 → list reverse lookup

🤖 Generated with Claude Code

https://claude.ai/code/session_013QAJ4vvsW1qwgCFM6Bn2Sh

Summary by CodeRabbit

  • 新機能
    • セッション間で宛先を指定したメッセージを送受信できるようになりました。
    • 送信済みメッセージの既読状態を確認できます。
    • セッションのラベル、担当タスク、経過時間を一覧表示できます。
  • 改善
    • ターン終了時に未読メッセージを自動配信し、未読がない場合は無音になりました。
    • メッセージの安全な整形とサイズ制限に対応しました。
    • コンテキスト圧縮前に変更内容を自動保存できるようになりました。
  • ドキュメント
    • メッセージ配信、セッション連携、フック動作の説明を更新しました。

tachibanashuuta and others added 13 commits July 21, 2026 11:47
…directed msg + identity fix + auto task declaration)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QAJ4vvsW1qwgCFM6Bn2Sh
…lock (operator UX request)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rough merge)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e cards (Task 121.4)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…compaction (Task 121.6)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nc mirrors (121.4 integration)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…(Task 121.1)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ask 121.2)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… + zero-unread silence (Task 121.3)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…le + CHANGELOG + rebuild 4-platform binaries (Task 121.5)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 699f7d4825

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +199 to +201
Unread: len(entries),
Messages: entries,
InjectContext: buildLivemsgInjectContext(entries, locale),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce the byte cap on the complete hook response

When one or more large messages are unread, only inject_context is capped: Messages still contains every body at up to 4096 bytes each, and the Stop hook emits this entire JSON object. Consequently even one message can exceed the advertised 4096-byte total, while a message flood produces unbounded hook output and context pressure. Limit or omit the raw message bodies from this delivery response so the cap covers everything written to stdout.

Useful? React with 👍 / 👎.

Comment on lines +190 to 193
entries = append(entries, sanitizeInboxCheckEntry(entry))
if err := store.MarkRead(ctx, opts.Team, msg.ID, opts.Agent); err != nil {
return empty, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Leave messages unread when they are omitted by the cap

When enough unread messages exceed the 4096-byte injection budget, buildLivemsgInjectContext omits the tail, but this loop marks every fetched message read before knowing which entries were emitted. Consumers of inject_context therefore never receive the omitted messages, and the next check is silent because they are already acknowledged. Mark only emitted messages read, or paginate the inbox so overflow remains queued.

Useful? React with 👍 / 👎.

Comment on lines +173 to +176
if out, err := commitCmd.CombinedOutput(); err != nil {
resetCmd := exec.Command("git", "reset", "HEAD", "--", relPath)
resetCmd.Dir = projectRoot
_ = resetCmd.Run()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the previous Plans.md index state on commit failure

If Plans.md already has intentionally staged changes and the automatic commit fails—for example because Git identity is missing or a commit hook rejects it—this unconditional reset removes those staged entries rather than restoring the index state from before git add. Checked git reset -h: the pathspec form operates on the selected index entries. The working-tree data remains, but the user's staging state is silently lost; snapshot the prior index entry and restore it on failure instead.

Useful? React with 👍 / 👎.

@Chachamaru127
Chachamaru127 merged commit 1a3af98 into main Jul 21, 2026
9 of 10 checks passed
Chachamaru127 pushed a commit that referenced this pull request Jul 21, 2026
…a3af98)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 520bd3c8-d793-43e4-822f-dfd2f1eebdc1

📥 Commits

Reviewing files that changed from the base of the PR and between 2562592 and 699f7d4.

⛔ Files ignored due to path filters (3)
  • bin/harness-windows-amd64.exe is excluded by !**/*.exe
  • go/cmd/harness/testdata/gen/codex-hooks.json is excluded by !**/gen/**
  • go/cmd/harness/testdata/gen/cursor-hooks.json is excluded by !**/gen/**
📒 Files selected for processing (41)
  • .claude-plugin/hooks.json
  • CHANGELOG.md
  • CLAUDE.md
  • Plans.md
  • bin/harness-darwin-amd64
  • bin/harness-darwin-arm64
  • bin/harness-linux-amd64
  • docs/CLAUDE-feature-table.md
  • docs/claude-livemsg-delivery.md
  • docs/spec/operations-memory-and-collaboration.md
  • go/cmd/harness/inbox.go
  • go/cmd/harness/inbox_check.go
  • go/cmd/harness/inbox_check_delivery_test.go
  • go/cmd/harness/inbox_check_test.go
  • go/cmd/harness/inbox_monitor.go
  • go/cmd/harness/inbox_send.go
  • go/cmd/harness/inbox_trust.go
  • go/cmd/harness/inbox_trust_test.go
  • go/cmd/harness/main.go
  • go/cmd/harness/pre_compact.go
  • go/cmd/harness/pre_compact_test.go
  • go/cmd/harness/session.go
  • go/cmd/harness/session_test.go
  • go/internal/deliveryidentity/deliveryidentity.go
  • go/internal/deliveryidentity/deliveryidentity_test.go
  • go/internal/hookhandler/session_presence.go
  • go/internal/hookhandler/session_register.go
  • go/internal/hookhandler/session_team_view.go
  • go/internal/hookhandler/session_team_view_test.go
  • go/internal/hostgen/hostgen.go
  • go/internal/hostgen/hostgen_delivery_identity_test.go
  • go/internal/livemsg/livemsg.go
  • go/internal/livemsg/sent_test.go
  • hooks/hooks.json
  • opencode/AGENTS.md
  • opencode/skills/breezing/SKILL.md
  • opencode/skills/harness-work/SKILL.md
  • scripts/session-list.sh
  • skills/breezing/SKILL.md
  • skills/harness-work/SKILL.md
  • tests/test-hooks-sync.sh
🔥 Files not summarized due to errors (2)
  • bin/harness-darwin-amd64: Server error: no LLM provider could handle the message
  • bin/harness-darwin-arm64: Server error: no LLM provider could handle the message

Walkthrough

Changes

livemsg 配送と受信

Layer / File(s) Summary
配送 identity と hook 生成
go/internal/deliveryidentity/*, go/internal/hostgen/*, hooks/hooks.json, .claude-plugin/hooks.json
環境変数ベースの identity 解決と inbox check --from-env の hook 生成・Stop 配線を追加。
inbox 送受信と trust contract
go/cmd/harness/inbox*.go, go/cmd/harness/main.go, go/cmd/harness/*_test.go
送信・送信済み一覧・受信確認、サニタイズ、サイズ制限、未読時のみの出力、既読更新を実装。
送信済み既読 projection
go/internal/livemsg/*
送信者向けメッセージ一覧に Read と ReadAt を追加。
配送仕様と運用記録
docs/*, CLAUDE.md, opencode/AGENTS.md, CHANGELOG.md, Plans.md
配送契約、identity 解決、Stop hook、monitor の既定状態を記録。

セッション presence

Layer / File(s) Summary
presence card 保存と一覧生成
go/internal/hookhandler/session_*.go, go/internal/hookhandler/session_team_view_test.go
label・task・since の保存、宣言・解除、セッション一覧表示を追加。
session CLI と一覧ラッパー
go/cmd/harness/session.go, go/cmd/harness/main.go, scripts/session-list.sh, go/cmd/harness/session_test.go
harness session declare/list と clear 処理を追加し、一覧 script を CLI 委譲へ変更。
presence 運用フロー
skills/*, opencode/skills/*, docs/CLAUDE-feature-table.md, Plans.md
作業開始・委譲開始と完了時の presence 宣言・解除手順を更新。

PreCompact 自動 checkpoint

Layer / File(s) Summary
Plans.md 自動 checkpoint
go/cmd/harness/pre_compact.go, go/cmd/harness/pre_compact_test.go
Plans.md のみを自動 commit し、成功時は compact を続行、失敗時または opt-out 時は block。
PreCompact 仕様と記録
CHANGELOG.md, Plans.md, docs/CLAUDE-feature-table.md
自動 checkpoint、continue、block 条件を各文書へ反映。

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Sender
  participant InboxSend
  participant LivemsgStore
  participant StopHook
  participant InboxCheck
  Sender->>InboxSend: inbox send
  InboxSend->>LivemsgStore: Send sanitized message
  StopHook->>InboxCheck: inbox check
  InboxCheck->>LivemsgStore: Read unread messages
  LivemsgStore-->>InboxCheck: messages
  InboxCheck-->>StopHook: inject_context JSON
  InboxCheck->>LivemsgStore: MarkRead
Loading

Poem

ぴょんと跳ねたら、便りが届く
ラベル掲げて、仲間が見える
Plans はそっと、箱へしまわれ
圧縮の道を、軽やかに行く
月夜の兎も、既読を確認!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Chachamaru127/main

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant