daybook/skills/daybook-posting/SKILL.md
peter 07328a3412 Fix issues #002-#006 found by the LLM test harness
- #006 (high, data loss): make_room_for() no longer deletes unkept
  artifacts on a doomed request - checks whether eviction can possibly
  succeed before deleting anything. Also fixed a related latent bug found
  while testing: the function returned evicted Artifact objects after
  calling .delete() on them, so their .id was always None (Django clears
  pk on delete); now returns ids captured beforehand.
- #003: added server-side field-length validation (source/title/
  source_name/source_id/theme) on POST and PATCH, matching the model's
  own max_length limits, which were previously unenforced on the ingest
  path entirely.
- #004: ported daybook_post.py's content-shape validation
  (html_fragment/html_full/deck/markdown) to the server, closing the gap
  for any client that doesn't go through the helper script.
- #005: PATCH now rejects wrong-typed `tags` (previously silently wiped
  existing tags) and rejects immutable fields (content/source/kind/day)
  with 400 instead of silently no-op'ing them.
- #002: deleted the misleading skills/daybook-posting/.env.example (a
  zero-dependency script that never reads .env files) and clarified
  SKILL.md/docs/llm_posting_helper.md that these must be real
  process/shell env vars.

Adds tests/unit/ for storage-layer tests. 46 tests passing (was 25).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 13:38:59 +01:00

3.5 KiB

name description
daybook-posting Use when you have produced a finished deliverable such as a report, summary, brief, diagram, generated HTML, PDF, deck, or status update that a human should review later outside this chat. Publishes the artifact to Daybook and returns a URL.

Daybook Posting

Daybook is a private artifact journal for completed agent outputs. It stores, indexes, and displays artifacts for human review. It does not execute commands, run workflows, or continue conversations.

Always use the helper script. Do not hand-build curl, JSON, PowerShell multipart, or inline shell content.

From the project root:

python skills/daybook-posting/scripts/daybook_post.py --check
python skills/daybook-posting/scripts/daybook_post.py --kind markdown --title "Build Report" --content-file report.md
cat report.md | python skills/daybook-posting/scripts/daybook_post.py --kind markdown --title "Build Report"
python skills/daybook-posting/scripts/daybook_post.py --file diagram.svg --title "Architecture Diagram"

The project also keeps a compatibility wrapper at scripts/daybook_post.py, but the canonical helper is bundled inside this skill.

The artifact URL is printed as the final stdout line.

Configuration

Set these as real process/shell environment variables (export on Linux/macOS, $env: or set on Windows, or your agent harness's own env config) — the helper reads os.environ directly. There is no .env file support; a .env file in the working directory is not read automatically.

DAYBOOK_URL=http://127.0.0.1:8001
DAYBOOK_TOKEN=your-personal-api-token
DAYBOOK_SOURCE=agent

DAYBOOK_TOKEN is your personal per-user API token, from Settings → Account in the app (not a token shared by everyone). Artifacts posted with your token land only in your feed.

Kind Cheat Sheet

Kind Use for Content shape
markdown Reports, briefs, notes Markdown text.
html_fragment Themed HTML reports/cards/tables Body-only HTML. No html/head/body.
html_full Complete custom pages/frameworks Full HTML document with doctype/html/head/body.
deck Simple slide-like artifact Top-level <section>...</section> blocks.

For images, PDFs, SVGs, and other files, use --file; the helper infers multipart and content type.

Images Inside Content

To embed an image within a markdown or HTML artifact (rather than posting it as its own artifact), upload it first and reference the returned URL:

# 1. Upload -> prints the URL as the last line
python skills/daybook-posting/scripts/daybook_post.py --upload-image chart.png

# 2. Reference that URL in your markdown, then post as usual
#    ![chart](http://127.0.0.1:8001/assets/ab12cd34ef56)
python skills/daybook-posting/scripts/daybook_post.py report.md

The image is linked to the artifact that references it and is deleted along with it. Unreferenced uploads are cleaned up after 24 hours.

For CSV, JSON, or code that should render today, use --file path --as-markdown to post it as a Markdown fenced code block. Without --as-markdown, these upload as downloadable binary files.

Rules

  • Run --check first if unsure Daybook is reachable.
  • Use a stable DAYBOOK_SOURCE or pass --source (the agent-profile, script, or person name that produced this artifact).
  • Use --tags a,b,c for filtering.
  • Use --meta run_id=... --meta model=... for machine-readable context.
  • Never inline multiline content into the shell command; use a file or stdin.