Skip to content

Add background-safe reads, split layouts, and media metadata#17

Draft
MadKangYu wants to merge 5 commits into
channprj:mainfrom
MadKangYu:codex/background-safe-read-media
Draft

Add background-safe reads, split layouts, and media metadata#17
MadKangYu wants to merge 5 commits into
channprj:mainfrom
MadKangYu:codex/background-safe-read-media

Conversation

@MadKangYu

@MadKangYu MadKangYu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add read --background-safe to read only already exposed matching chat windows without launching, activating, logging in, searching, resizing, opening, or closing windows
  • expose the same non-disruptive mode through MCP as kmsg_read.background_safe
  • keep MCP startup handshakes nonblocking by skipping foreground KakaoTalk status checks unless KMSG_MCP_STARTUP_STATUS_CHECK=true is explicitly set
  • hide available window titles on background-safe failures to avoid leaking private chat names
  • expose message-level has_image, image_count, link_count, has_attachment, and attachment_count fields in read JSON
  • add split-left and split-right read layouts for marketing operators who keep KakaoTalk beside browsers or ad tools
  • let the CLI help/examples follow the installed executable name, so local operations can install this patched build as kangyu instead of replacing kmsg
  • document the Madstamp deployment convention: official upstream is https://github.com/channprj/kmsg; KangYu/Madstamp uses MCP server ID kmsg.kangyu with command /Users/yu/.local/bin/kangyu until this patch lands upstream
  • document the new modes and add contract tests

Deployment identity

Verification

  • swift build
  • swift build -c release
  • python3 -m unittest discover -s tests
  • /Users/yu/.local/bin/kangyu --help shows kangyu in usage/examples
  • /Users/yu/.local/bin/kangyu read --help lists split-left and split-right layouts
  • no-chat MCP schema handshake: initialize + tools/list returns kmsg_read.background_safe, startup status_check=skipped, and Hermes env layout default split-right
  • hermes --profile madstamp mcp list shows kmsg.kangyu enabled with /Users/yu/.local/bin/kangyu

Notes

  • This is an AX-safe mode, not a Kakao database reader. It intentionally fails when the target chat window is not already exposed.
  • Raw image content is not captured or serialized; only message-level media metadata is emitted.
  • split-left / split-right are explicit layout requests. --background-safe still preserves existing window focus, size, and position.
  • Verification avoids fake chat-name searches and avoids live chat reads.

@MadKangYu MadKangYu changed the title Add background-safe Kakao reads and media metadata Add background-safe reads, split layouts, and media metadata Jun 11, 2026
Background-safe reads must fail cleanly instead of activating KakaoTalk, opening rooms, or leaking available chat titles. The read JSON now also carries media/link/attachment metadata so operations can queue image-bearing messages without storing raw image content.

Constraint: AX-based Kakao reads can only inspect exposed UI safely without stealing focus

Rejected: Frequent idle polling wrapper | still risks user disruption and lives outside the CLI contract

Rejected: Raw image capture in read JSON | would expand private data exposure beyond message metadata

Confidence: medium

Scope-risk: moderate

Directive: Do not make background-safe paths call activate, launch, login, search, resize, or close windows without revalidating operator impact

Tested: swift build

Tested: python3 -m unittest discover -s tests

Tested: kmsg read __codex_no_such_chat__ --background-safe exits with BACKGROUND_SAFE_BLOCKED and hides window titles
Marketing operators need to keep KakaoTalk beside browsers and ad tools without the CLI resizing into a large operator-only window. The read command now supports split-left and split-right layouts, MCP accepts the same values, and the entrypoint follows the installed executable name so local operations can install the patched build as kangyu instead of replacing kmsg.

Constraint: Local automation should not overwrite the existing kmsg command when the operator asks for a separate kangyu command

Rejected: Symlink kangyu to a kmsg-named binary only | help and examples would still instruct users to run kmsg

Confidence: high

Scope-risk: narrow

Directive: Keep background-safe behavior non-mutating; split layouts are for explicit layout requests only

Tested: swift build

Tested: python3 -m unittest discover -s tests

Tested: /Users/yu/.local/bin/kangyu --help shows kangyu and read --layout split-left/split-right

Tested: /Users/yu/.local/bin/kangyu read __codex_no_such_chat__ --background-safe --limit 1 --json exits with BACKGROUND_SAFE_BLOCKED
Madstamp runs the patched upstream kmsg build as a separate kangyu executable and a kmsg.kangyu MCP server ID until the upstream PR lands. Documenting the source-of-truth repo URLs prevents operators from replacing the canonical kmsg binary or guessing which fork owns the deployment patch.\n\nConstraint: Upstream official repository remains channprj/kmsg\nConstraint: Local Madstamp Hermes profile should not overwrite /Users/yu/.local/bin/kmsg\nRejected: Rename the upstream project to KangYu | would confuse upstream PR review and public package identity\nConfidence: high\nScope-risk: narrow\nDirective: Keep MCP server ID kmsg.kangyu for Madstamp profile while command points to /Users/yu/.local/bin/kangyu\nTested: python3 -m unittest discover -s tests\nTested: hermes --profile madstamp mcp list shows kmsg.kangyu enabled\nNot-tested: Upstream maintainer acceptance of the deployment naming note
The CLI supported --background-safe, but MCP clients could not request it, so Hermes would still have to choose between normal read and split layout behavior. Add a background_safe tool argument, pass it to read, and avoid automatic deep-recovery retry in that mode so a blocked background-safe read remains non-disruptive.\n\nConstraint: Background-safe MCP reads must not fall through into window-opening recovery behavior\nRejected: Rely on split-right default layout only | still permits operator-visible UI movement and misses the user's background-read requirement\nConfidence: high\nScope-risk: narrow\nDirective: Keep background_safe available on kmsg_read whenever --background-safe exists on the CLI\nTested: swift build\nTested: python3 -m unittest discover -s tests\nNot-tested: Live KakaoTalk MCP read of a real exposed chat window
MCP initialize was still running a Kakao status probe during startup, so an AX or app-state stall could block Hermes before tools/list was available. Startup now verifies the executable version and skips status by default, while retaining an opt-in KMSG_MCP_STARTUP_STATUS_CHECK gate for manual diagnostics.\n\nConstraint: MCP clients need initialize/tools-list to return even when KakaoTalk UI readiness is unstable\nRejected: Increase the status timeout | it preserves the blocking failure mode\nConfidence: high\nScope-risk: narrow\nDirective: Do not make MCP initialize depend on foreground KakaoTalk UI state by default\nTested: swift build\nTested: python3 -m unittest discover -s tests\nNot-tested: KMSG_MCP_STARTUP_STATUS_CHECK=true on a healthy live KakaoTalk session
@MadKangYu MadKangYu force-pushed the codex/background-safe-read-media branch from 44bafcb to c43fa11 Compare June 11, 2026 10:14
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