Chat web

From leopu00/job-hunter-team · View interactive version

Chat web is an AI agent skill from the GitHub repository leopu00/job-hunter-team. Reply to the user when they message you from the JHT web chat. The user reaches you with the prefix `[@utente -> @capitano] [CHAT] <body>`; reply ONLY with `jht-send` — never write to `chat.jsonl` by hand (shell quoting breaks the JSON line and the frontend silently drops the message, the user sees

How to use this skill

Skill file

chat-web — user ↔ Captain protocol

The user does not sit in a tmux session. They write from the web UI. The frontend tags the message and drops it into your tmux pane. To reply, you write a single JSON line into $JHT_AGENT_DIR/chat.jsonl; the frontend tails that file and renders bubbles in the chat panel.

You don't write the JSON. The wrapper jht-send does it for you, with timestamp + done flag + post-write validation. Use it. Always.

How to recognize an incoming `[CHAT]`

[@utente -> @capitano] [CHAT] <whatever the user typed>

⚠️ Common failure mode the first time you see this: you read the prefix and think "let me reply via jht-tmux-send to the user". jht-tmux-send UTENTE ... returns exit 2 (no such session). Do not start debugging — just remember that [CHAT] ⇒ jht-send. Always.

⚠️ The user is NON-TECHNICAL — no terminal, no CLI, no slash commands

A [CHAT] message comes from the desktop app (or Telegram). The user does

not have a terminal, the Claude Code CLI, /mcp, slash commands, or file

access. They are not a developer. NEVER tell them to:

Telling a desktop user "type /mcp in the terminal" is a dead end — they can't.

If a task needs a capability you don't have wired up, **solve it yourself with

code** instead of bouncing the work back to the user. You are the team; the user

is the client. Figure it out.

Example: sending an email — you do NOT need an MCP/Gmail tool

The team already has a configured mailbox. Send through the script: it reads

the account by itself and prints only {"ok": true, ...} or a reason code.

python3 /app/shared/skills/email_monitor.py send --to "<recipient>" --subject '<subject>' --body - <<'TXT'
<body>
TXT

The body goes on stdin with a quoted heredoc: between double quotes the shell eats a $ followed by a digit ($20 reaches the company as 0); the same for the subject, which goes between single quotes. Write the closing TXT in the first column, alone on its line, with no spaces before it (copy the indentation and the heredoc never closes: a body that ends in a TXT line is refused, nothing is sent).

Never open, cat, json.load or print anything under $JHT_HOME/credentials/,

and never put a password in a script, a chat or a log: the script is the only

thing that touches the account. "reason": "not_configured" means no mailbox is

set up yet: tell the user to save it with jht mail setup on the computer

that runs the team.

The answer says what happened:

user: it leaves only when they approve it (jht mail drafts, then

jht mail approve <id>). Tell them exactly that, with the draft id; never say

it was sent.

Never "go authorize Gmail".

If you genuinely need a slash command / tool in YOUR session

You can drive your own session — don't ask the user:

jht-tmux-send <YOUR_SESSION> '/mcp' (then a separate Enter), or

(jht-tmux-send CAPITANO '...inject /mcp into ASSISTENTE...') and the Captain

runs jht-tmux-send ASSISTENTE '/mcp'. The user is never involved.

Reply commands

jht-send 'Final reply that closes the turn.'
jht-send --partial 'Working on it…'   # mid-turn checkpoint, keeps the turn open

Rules:

Message kind (`--kind`)

jht-send --kind <kind> '...' tags the message (default info, which writes nothing extra). The kind is yours to declare: the tool takes it as you give it and writes it as is, nothing checks it. It only applies to a final message: not with --partial and not with --role system.

Questions with choices are not a kind: use jht-notify-user --option id="Label"; --kind question is refused. When in doubt between a question and blocked: if you can do something else meanwhile, it is a question. After a question do not stop: carry on with what you can do until the answer arrives.

When to use `--partial`

Use it whenever a user-facing operation will take more than ~3 seconds and you do not have the answer yet. Without --partial between user message and final reply, the frontend hides the typing dots and the chat looks dead.

Pattern:

[CHAT] arrives
   ↓
jht-send --partial 'Looking into it — give me a moment…'
   ↓
(do the work: db_query, capture-pane, analysis, …)
   ↓
jht-send 'Here is what I found: …'   ← no --partial = closes the turn

If a single operation goes past ~30-45s without a signal, send another --partial checkpoint. The user must never sit silent for longer than that.

Examples (Captain ↔ user)

# Answer a question about pipeline state — fast, single shot
jht-send 'Pipeline at 132 positions: 18 new, 47 checked, 31 scored, 28 ready. Two writers active.'

# Long-running analysis — checkpoint, then close
jht-send --partial 'Pulling stats and the last 50 reviews — one moment…'
# (run db_query.py stats, db_query.py applications --critic-score-max 5)
jht-send $'Here is the picture:\n\n• Pipeline healthy on the discovery side.\n• Writers stuck on 4 positions averaging score 3.2 → I am pausing them and reopening triage.'

# Closing the turn after applying a user request
jht-send 'Done. Spawned an extra Analyst, throttle config dumped to the log.'

Anti-patterns (what NOT to do)

Sending to a non-default channel (rare)

jht-send --agent capitano 'system-level note routed via my channel'

Useful when you want to log a system message into your own chat channel (e.g. an automation noting it has acted on the user's behalf). For day-to-day replies you never need this flag.

Why `jht-send` and not raw shell

History (do not repeat): agents tried echo-into-jsonl and cat <<EOF heredocs. Both finished in fragile modes — the first explodes on quotes/$, the second freezes the timestamp as a literal string. Result: invalid JSON the frontend skips. The user sees nothing; you think you have replied. jht-send removes the failure mode entirely — the body never re-enters a shell parser after the first level of quoting.

See also

small bounded decision in the game; never a fixed onboarding script.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.