Přeskočit na obsah

Tato stránka byla automaticky přeložena z angličtiny, jediného jazyka, ve kterém se tento web píše. Číst originál.

Uchovat prompty, které práci zahájily, pod modelem, ne kolem něj

Zapojte hook providera, dokažte jej protažením payloadu a ověřte, že prompt, který nástroj nedokázal parsovat, se ohlásí, a ne tiše zahodí.

zaručeno Relace a předávkazákladnímaintaineragentzapisuje stav

Situace

Prompt, který práci zahájil, je jediná věc, kterou nikdo neuchovává. Žije v přepisu poskytovatele, který další relace nepřečte, takže za šest týdnů repozitář drží změnu a žádný záznam o tom, co bylo požadováno.

Scénář

setup: capture-installed
given:
  - 'Majordomus installed, with the provider hook written and the executable on PATH'
steps:
  - id: is-it-real
    run: ['capture', 'status']
    note: 'the state is read from the provider configuration and a payload driven through the shim, not from a flag somebody set'
    expect:
      exit: 0
      stdout_contains: ['claude-code', 'majordomus-capture']
  - id: one-prompt-one-record
    run: ['capture', 'prompt', '--provider', 'claude-code']
    stdin: claude-code-prompt.json
    note: 'what the provider sends on UserPromptSubmit; the record is the person half of the exchange'
    expect:
      exit: 0
      files_exist: ['.ai/local/prompts']
  - id: both-formats-or-neither
    run: ['capture', 'render']
    note: 'a prompt is kept twice under one stem: the record for a machine, the rendering for a person. render rebuilds a missing rendering from its record and never the other way round, because only that direction is possible'
    expect:
      exit: 0
      stdout_contains: ['rendering']
  - id: never-rejects-a-prompt
    run: ['capture', 'prompt', '--provider', 'claude-code']
    stdin: not-a-payload.txt
    note: 'in a hook, exit 2 rejects the person prompt, so a payload the tool cannot read is written to the failure log and the turn goes on'
    expect:
      exit: 0
      files_exist: ['.ai/local/prompts/.capture.log']
  - id: a-subcommand-that-is-not-one
    run: ['capture', 'nonsense']
    note: 'the command line still refuses what a person typed wrong: only the hook path is forbidden to exit 2'
    expect:
      exit: 2
      stdout_contains: ['unknown subcommand']
then:
  - 'the archive is written under the ignored half of the layer and never committed'
  - 'every prompt is present as both a JSON record and its Markdown rendering'
  - 'a prompt the tool could not read is a named failure, not a silence'

Výsledek

Prompty se zachytávají pod modelem hookem providera do souborů, které repozitář ignoruje a nic je nenačítá do kontextu. Zda je zapojení skutečné, se zjišťuje průchodem payloadu, ne tvrzením, a payload, který nejde přečíst, je nahlášen, a ne zahozen.

Každý prompt se uchovává dvakrát pod jedním kmenem, protože oba čtenáři jsou různí. Záznam .json je to, co provider poslal — jeho vlastní spany, stále escapované, hezky vypsané jeden člen na řádek — a z něj se odvozuje všechno ostatní. .md vedle něj je ten záznam vykreslený pro člověka: pole jako front matter a znovu jako tabulka, pak samotný prompt pod ## PROMPT, dekódovaný a ohraničený. Archiv, který nikdo neotevře, je důkazem ničeho, a vykreslení, z něhož nelze nic znovu sestavit, není důkazem vůbec, takže dvojice se vynucuje, a nenechává zvyku. Asymetrie činí toto bezpečným: capture render znovu sestaví jakékoli vykreslení z jeho záznamu a žádný příkaz nemůže jít opačným směrem.

Scénář

Provedeno proti skutečnému nástroji v repozitáři připraveném pomocí capture-installed, při každém generování tohoto webu. To, co následuje, není popis toho, co by se mělo stát; je to to, co se stalo.

dáno

  • Majordomus nainstalován, s napsaným hookem poskytovatele a spustitelným souborem v PATH

kdy

  1. 1majordomus capture status
  2. 2majordomus capture prompt --provider claude-code
  3. 3majordomus capture render
  4. 4majordomus capture prompt --provider claude-code
  5. 5majordomus capture nonsense

pak

  • archiv se zapisuje do ignorované poloviny vrstvy a nikdy se necommituje
  • každý prompt existuje jako záznam JSON i jako své vykreslení v Markdownu
  • prompt, který nástroj nemohl přečíst, je pojmenované selhání, ne mlčení

Co nástroj udělal

Důkaz běhu, z něhož byla tato stránka vygenerována: pass, 5 kroků. Výstup je normalizován: cesta repozitáře, časová razítka, id a doby trvání jsou zástupné hodnoty; nic dalšího se neupravuje.

Testováno v test/cases/94_use_cases.sh, který spouští každý scénář a odmítne krok, jehož zaznamenaný výstup není tím, co vyprodukoval.

  1. stav se čte z konfigurace providera a z payloadu protlačeného shimem, ne z příznaku, který někdo nastavil

    agents                 unsupported  none        as above: a convention hands nothing to anything.
    agents:session         unsupported  none        not a product but a class of tools defined by the file they read (agents.md). A convention has no process and no events; the concrete tool's own entry in this file is what says what it can do.
    bb                     unsupported  none        same search, same date, same caveat: nothing published hands a prompt to an external command before the model runs. Because bb runs Claude Code and Codex as child processes, each child's own prompt hook fires underneath it — the coverage is the agent's, never bb's.
    bb:session             unsupported  none        no conversation-lifecycle hook is published. Searched <date>: getbb.app; github.com/get-bb/bb docs/ (25 files), plugins/ (31 plugins), README.md; docs/configuration.md ('Repository worktree hooks') and docs/cli-guide-and-skill.md document only .bb-env-setup.sh / .bb-env-teardown.sh, which fire on environment provisioning and removal. docs/provider-plugin-api.md names an internal system/interaction/lifecycle event stream with no external-command contract. The @get-bb/plugin-sdk surface is rendered in-app and not published, so this is an absence of documentation, not a documented absence. ADR 0024 reached the same conclusion: the agent bb runs keeps the hook.
    claude-code            verified     hook        .claude/hooks/majordomus-capture is wired, and a synthetic payload through it produced one record and its rendering
    claude-code:session    verified     hooks       .claude/hooks/majordomus-session-start, .claude/hooks/majordomus-session-end, .claude/hooks/majordomus-session-compact are wired, and a synthetic payload through the end shim reached the command
    codex                  unadapted    hook        the provider documents a prompt event and this distribution ships no adapter for it — https://learn.chatgpt.com/docs/hooks — UserPromptSubmit, 'Runs when a user submits a prompt, before model invocation, and can block the prompt'; the raw text arrives as `prompt` (not `prompt_text`, as Claude Code sends it). Verified <date>.
    codex:session          unadapted    hooks       the provider documents session events and this distribution ships no adapter for them — https://learn.chatgpt.com/docs/hooks (canonical; developers.openai.com/codex/hooks 308-redirects to it) — SessionStart (source: startup, resume, clear, compact), SessionEnd, PreCompact and PostCompact; PreCompact can block with continue:false. Configured in ~/.codex/hooks.json or an inline [hooks] table in .codex/config.toml. Verified <date>. The `notify` key is NOT this: https://learn.chatgpt.com/docs/config-file/config-advanced says it fires 'whenever Codex emits supported events (currently only agent-turn-complete)' — after a turn, never at a session boundary.
    gemini                 unadapted    hook        the provider documents a prompt event and this distribution ships no adapter for it — https://github.com/google-gemini/gemini-cli/blob/main/docs/hooks/reference.md — BeforeAgent, 'Fires after a user submits a prompt, but before the agent begins planning'; the raw text arrives as `prompt`. BeforeModel fires later, on the assembled request. Verified <date>.
    gemini:session         unadapted    hooks       the provider documents session events and this distribution ships no adapter for them — https://github.com/google-gemini/gemini-cli/blob/main/docs/hooks/reference.md and https://geminicli.com/docs/hooks/ — SessionStart (source: startup, resume, clear), SessionEnd (reason: exit, clear, logout, prompt_input_exit, other), PreCompress (trigger: auto, manual). Configured as a hooks block in settings.json. Tracker github.com/google-gemini/gemini-cli/issues/9070 'Comprehensive Hooking System' is closed, 34 of 34. Verified <date>. Two caveats an adapter must carry: the CLI does not wait for SessionEnd, and PreCompress is advisory and cannot block.
    generic                unsupported  none        no vendor documentation is involved: a worker with no convention of its own exposes no event, and the MCP connection cannot stand in. An MCP server receives initialize, tool calls and notifications; the person's prompt is never among them, in any version of the protocol (modelcontextprotocol.io/specification). Declared none rather than left blank so that no surface can imply otherwise.
    generic:session        unconfigured connection  bin/majordomus-mcp does not exist, so no client can start the shared server whose connection is the boundary
    (no adapter)           n/a          this tool ships no capture adapter for: agents bb codex gemini generic; they read the model and lose the automation
    • exit 0
    • stdout_contains /claude-code/
    • stdout_contains /majordomus-capture/
  2. 2$ majordomus capture prompt --provider claude-code exit 0< claude-code-prompt.json

    co provider posílá při UserPromptSubmit; záznam je lidská polovina výměny

    • exit 0
    • file_exists .ai/local/prompts
  3. prompt se uchovává dvakrát pod jedním základem názvu: záznam pro stroj a vykreslení pro člověka. render znovu vytvoří chybějící vykreslení ze záznamu, nikdy naopak, protože možný je jen tento směr

    0 rendering(s) written into .ai/local/prompts
    • exit 0
    • stdout_contains /rendering/
  4. v hooku exit 2 odmítne prompt člověka, takže payload, který nástroj nepřečte, se zapíše do logu selhání a tah pokračuje

    • exit 0
    • file_exists .ai/local/prompts/.capture.log
  5. příkazový řádek stále odmítá, co člověk zadal špatně: jen cesta hooku nesmí skončit kódem 2

    majordomus: capture: unknown subcommand 'nonsense' (prompt|render|reconcile|prune|session|install|status)
    • exit 2
    • stdout_contains /unknown subcommand/

Proč to nástroj ví

Řetězec od této stránky ke kódu: případ užití jmenuje příkazy, pravidla a tvrzení; každé pravidlo se dispatchuje z registru a každé tvrzení jmenuje test, který ho dokazuje; scénář výše provedl příkazy. Nic v tomto řetězci není text o záměru.

Pravidla, díky nimž platí

Uplatněné záruky

Související případy užití

Vypočteno z toho, co sdílejí: tvrzení, pravidla, příkazy, kategorie, aplikace. Tento seznam nikdo neudržuje.

Prohledává názvy a popisy všech stránek, které tento web publikuje.