#PDF Cover Letter generator
1 messages Β· Page 1 of 1 (latest)
This is a very good OpenClaw use case.
Iβd build it in 2 phases:
- Make it work interactively in the terminal with a dedicated
coverletteragent. - Add a one-command shell wrapper once the agent workflow is stable.
Also, because this agent needs host shell execution, I strongly recommend keeping it TUI-only or private, not bound to a public channel.
Docs I verified before answering:
- FAQ: https://docs.openclaw.ai/help/faq
- agents CLI: https://docs.openclaw.ai/cli/agents
- TUI: https://docs.openclaw.ai/cli/tui
- config CLI: https://docs.openclaw.ai/cli/config
- approvals CLI: https://docs.openclaw.ai/cli/approvals
- agent workspace: https://docs.openclaw.ai/concepts/agent-workspace
0. Verify your base install
Run these first:
openclaw --version
openclaw status
openclaw gateway status
openclaw config file
If the gateway is not up:
openclaw gateway start
If anything looks broken:
openclaw doctor
openclaw logs --follow
1. Create a dedicated agent
You already started covletter. Iβd use a clean agent id like coverletter.
Option A, keep your current typo
If you want to keep covletter, that is fine. Just substitute that id everywhere below.
Option B, recreate cleanly
If you want a clean name:
openclaw agents add coverletter \
--workspace "$HOME/.openclaw/workspace-coverletter" \
--non-interactive
Verify:
openclaw agents list
2. Create the workspace layout
Create a simple, predictable structure:
mkdir -p "$HOME/.openclaw/workspace-coverletter/bin"
mkdir -p "$HOME/.openclaw/workspace-coverletter/assets/cvs"
mkdir -p "$HOME/.openclaw/workspace-coverletter/jobs"
Now copy your real files in:
cp /path/to/template.tex "$HOME/.openclaw/workspace-coverletter/assets/template.tex"
cp /path/to/CV1.pdf "$HOME/.openclaw/workspace-coverletter/assets/cvs/"
cp /path/to/CV2.pdf "$HOME/.openclaw/workspace-coverletter/assets/cvs/"
cp /path/to/build.ksh "$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
chmod 755 "$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
Recommended final structure:
~/.openclaw/workspace-coverletter/
βββ AGENTS.md
βββ assets/
β βββ template.tex
β βββ cvs/
β βββ CV1.pdf
β βββ CV2.pdf
β βββ INDEX.md
βββ bin/
β βββ build.ksh
βββ jobs/
3. Make the build script agent-friendly
This part matters a lot.
Your build script should ideally follow this contract:
- input: one
.texfile path
- output: builds the PDF
- exit code
0on success - prints the final PDF path to stdout
If your current build.ksh already works like that
Skip this step.
If not, wrap it
Create a wrapper script that OpenClaw can call consistently:
cat > "$HOME/.openclaw/workspace-coverletter/bin/build-wrapper.ksh" <<'EOF'
#!/usr/bin/env ksh
set -eu
if [ "$#" -ne 1 ]; then
print -u2 "usage: $0 /path/to/coverletter.tex"
exit 64
fi
INPUT_TEX="$1"
# Replace the next line with your real build command if needed.
"$HOME/.openclaw/workspace-coverletter/bin/build.ksh" "$INPUT_TEX"
# If your real script does not print the PDF path, print it here instead.
# Example if PDF is generated next to the tex file:
DIR="$(cd "$(dirname "$INPUT_TEX")" && pwd)"
BASE="$(basename "$INPUT_TEX" .tex)"
print "$DIR/$BASE.pdf"
EOF
chmod 755 "$HOME/.openclaw/workspace-coverletter/bin/build-wrapper.ksh"
If you use the wrapper, point the agent to bin/build-wrapper.ksh instead of bin/build.ksh.
4. Create a CV index file
This is a nice trick. It lets the agent read available CV choices without needing extra shell commands.
(
cd "$HOME/.openclaw/workspace-coverletter/assets/cvs" || exit 1
printf "# Available CVs\n\n" > INDEX.md
for f in *.pdf; do
[ -e "$f" ] || continue
printf -- "- %s\n" "$f" >> INDEX.md
done
)
Check it:
cat "$HOME/.openclaw/workspace-coverletter/assets/cvs/INDEX.md"
5. Test the LaTeX toolchain before involving the agent
Make sure Linux can actually compile LaTeX.
Check binaries:
command -v ksh
command -v pdflatex
command -v latexmk
If missing, install them with your distroβs package manager.
For Debian/Ubuntu, a typical starting point is:
sudo apt update
sudo apt install -y ksh latexmk texlive-latex-base texlive-latex-recommended texlive-fonts-recommended
Now do a smoke test:
cat > "$HOME/.openclaw/workspace-coverletter/jobs/smoke-test.tex" <<'EOF'
\documentclass{article}
\begin{document}
Smoke test
\end{document}
EOF
Then run your build script manually:
"$HOME/.openclaw/workspace-coverletter/bin/build.ksh" \
"$HOME/.openclaw/workspace-coverletter/jobs/smoke-test.tex"
If you use the wrapper:
"$HOME/.openclaw/workspace-coverletter/bin/build-wrapper.ksh" \
"$HOME/.openclaw/workspace-coverletter/jobs/smoke-test.tex"
Do not continue until this works manually.
6. Teach the agent the workflow with AGENTS.md
Create this file:
cat > "$HOME/.openclaw/workspace-coverletter/AGENTS.md" <<'EOF'
# Cover Letter Agent
Your job is to create tailored cover letters as LaTeX and compile them into PDFs.
## Workspace contract
- LaTeX template: `assets/template.tex`
- Available CV list: `assets/cvs/INDEX.md`
- CV PDFs: `assets/cvs/*.pdf`
- Output directory: `jobs/`
- Build command: `bin/build.ksh <path-to-tex>`
- If a wrapper exists, use `bin/build-wrapper.ksh <path-to-tex>` instead.
## Workflow
When the user asks for a cover letter:
1. If the job URL is missing, ask for it.
2. If the CV choice is missing, read `assets/cvs/INDEX.md` and ask which CV to use.
3. Fetch the job posting text from the URL.
- Prefer `web_fetch`.
- If the page is too JS-heavy to read reliably, ask the user to paste the job text manually.
4. Read the selected CV PDF from `assets/cvs/`.
5. Read `assets/template.tex`.
6. Preserve the template structure and generate valid LaTeX only.
7. Create a new output folder under `jobs/`, using a timestamp and company slug if possible.
8. Write `coverletter.tex` into that folder.
9. Compile it using the build script.
10. If compilation fails, inspect the error, fix the LaTeX, and retry.
11. Reply with:
- the PDF path
- the `.tex` path
- a short summary of what was tailored
## Rules
- Never overwrite `assets/template.tex`.
- Never overwrite any CV PDF.
- Never write outside this workspace.
- Do not output Markdown when writing the LaTeX file.
- Keep company facts grounded in the fetched job text and the selected CV.
EOF
That one file is the core of the automation.
7. Give only this agent shell access for the build script
You want the agent to compile PDFs, but you do not want broad random shell freedom if you can avoid it.
First, inspect agent indexes:
openclaw config get agents.list --json
Find the array index for coverletter. Iβll assume it is 1 below. Replace 1 if yours is different.
Set per-agent exec policy:
openclaw config set 'agents.list[1].tools.exec.host' '"gateway"'
openclaw config set 'agents.list[1].tools.exec.security' '"allowlist"'
openclaw config set 'agents.list[1].tools.exec.ask' '"on-miss"'
Allowlist only the build script:
openclaw approvals allowlist add --agent coverletter \
"$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
If you use the wrapper, allowlist that instead:
openclaw approvals allowlist add --agent coverletter \
"$HOME/.openclaw/workspace-coverletter/bin/build-wrapper.ksh"
Then restart the gateway:
openclaw gateway restart
Check the effective approvals:
openclaw approvals get
Important note
If your gateway runs on a different machine, target the gateway approvals there with --gateway.
8. Start the agent in the terminal
This is the cleanest console-only entry point.
cd "$HOME/.openclaw/workspace-coverletter"
openclaw tui
Because you are inside that workspace, the TUI should use that agent/workspace context.
Your first message can simply be:
Create a cover letter
The agent should then ask:
- job URL
- which CV to use
That gives you the interactive flow you want.
9. One-shot CLI usage, no chat UI
Once the TUI version works, you can also run it as a single command:
openclaw agent --agent coverletter \
--message "Create a tailored cover letter for https://example.com/job/123 using CV2.pdf. Use the workspace template, compile the PDF, and tell me the output paths."
That is great for scripts.
10. Optional, add your own convenience wrapper
If you want a single shell command for daily use:
cat > "$HOME/.openclaw/workspace-coverletter/bin/make-letter.sh" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
JOB_URL="${1:-}"
CV_FILE="${2:-}"
if [ -z "$JOB_URL" ] || [ -z "$CV_FILE" ]; then
echo "usage: $0 <job-url> <cv-file>"
exit 64
fi
openclaw agent --agent coverletter \
--message "Create a tailored cover letter for ${JOB_URL} using ${CV_FILE}. Use the workspace template, compile the PDF, and tell me the output paths."
EOF
chmod 755 "$HOME/.openclaw/workspace-coverletter/bin/make-letter.sh"
Usage:
"$HOME/.openclaw/workspace-coverletter/bin/make-letter.sh" \
"https://example.com/job/123" \
"CV1.pdf"
11. How the full end-to-end flow works
After all that, the runtime flow is:
- You start
openclaw tuiin thecoverletterworkspace. - You say, βcreate a cover letterβ.
- The agent asks for missing inputs.
- It reads:
assets/template.tex- selected CV PDF
- job page text
- It writes
jobs/<something>/coverletter.tex - It runs the allowlisted build script
- It returns the
.texand.pdfpaths
No manual upload, no manual copy/paste, no manual compile step.
12. Practical tips
- Keep all CV PDFs inside the workspace so the agent can access them by path.
- Keep the template stable. Let the agent write only into
jobs/. - If the job page is rendered heavily with JavaScript,
web_fetchmay not get the full content. In that case, paste the job description manually, or later extend this with browser automation.
- If your CV PDFs are scanned images instead of real text PDFs, extraction can be worse. Text PDFs are much easier.
- Do not bind this agent to a public Discord server channel if it has host exec enabled.
13. Minimal test sequence
If you want the shortest possible checklist:
openclaw status
openclaw agents add coverletter --workspace "$HOME/.openclaw/workspace-coverletter" --non-interactive
mkdir -p "$HOME/.openclaw/workspace-coverletter/bin"
mkdir -p "$HOME/.openclaw/workspace-coverletter/assets/cvs"
mkdir -p "$HOME/.openclaw/workspace-coverletter/jobs"
cp /path/to/template.tex "$HOME/.openclaw/workspace-coverletter/assets/template.tex"
cp /path/to/CV1.pdf "$HOME/.openclaw/workspace-coverletter/assets/cvs/"
cp /path/to/build.ksh "$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
chmod 755 "$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
openclaw config get agents.list --json
openclaw config set 'agents.list[1].tools.exec.host' '"gateway"'
openclaw config set 'agents.list[1].tools.exec.security' '"allowlist"'
openclaw config set 'agents.list[1].tools.exec.ask' '"on-miss"'
openclaw approvals allowlist add --agent coverletter "$HOME/.openclaw/workspace-coverletter/bin/build.ksh"
openclaw gateway restart
cd "$HOME/.openclaw/workspace-coverletter"
openclaw tui
If you want, next message, paste: