Ready-to-paste AI-agent templates

8 expert boxes: each section includes Methodology, Pro tips, and Code blocks (copyable), plus a single full ready-to-paste agent template (anti-block + social verify + verification_engine + debug/self-heal). 4 full merged + 4 compact. AI-agent first. ToS-aware. Three-state only.

4 full merged 4 compact EXECUTE gate PASS | FAIL | INCONCLUSIVE verification_engine.py manager design
How to use: Each box is expert-ready: read Methodology + Tips, copy Code blocks as needed, then Copy full template and paste the entire pre block into your AI agent as the task contract. Prefer FULL MERGED for production; COMPACT for quick reference. Never claim done without read-after-write + final_gate PASS + (Console) done_allowed. Never like or delete comments.

A · Full merged templates

One copy = complete task contract for the agent

FULL MERGED · EXPERT · 1 COPY = COMPLETE TASK

Full 1/4 — Session · cookies · credentials · logging

Expert session steward: continuous health, cookie heal, three-state logs, quarantine, Console API.

Methodology (expert)

  • boot/self-check before any browser (proxy, geo/timezone/locale match, profile, vault, DISPLAY).
  • Classify session: alive | expired | checkpoint | locked | shadowban_canary.
  • Heal path: credentials → auto-login → capture → encrypt sessions/{account}.enc → chmod 600 → delete plaintext.
  • Inject cookies BEFORE first navigate; save AFTER confirmed success; silent refresh ~45m on long engage.
  • Quarantine on checkpoint/locked/shadowban — never ban-loop; L1/L2/L3 incident map.
  • One account → one IP/profile forever (Mode C multi-account).
  • Every step: correlation_id + JSONL log + progress.json verified only on PASS.

Pro tips

  • Never share cookie jars across brands.
  • Residential proxy reputation matters more than fingerprint magic.
  • Match exit IP = browser timezone = locale or security AI flags you.
  • Shadowban canary = real chrono/tag tab empty → L3 48h halt.
  • Never log passwords; evidence paths only.
  • Prefer Manager Console action=full_heal / verify; require done_allowed=true.

Code blocks · agent-ready

bash · session heal via Console API
RUN="runs/$(date +%Y-%m-%d_%H%M)_session_${ACCOUNT}"
mkdir -p "$RUN/evidence"
JOB=$(curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"action\":\"full_heal\",\"platform\":\"$PLATFORM\",\"label\":\"$ACCOUNT\"}" \
  https://manager.addict.best/console/api/run)
echo "$JOB" | tee "$RUN/job_start.json"
# poll /console/api/jobs/{id} until status=done AND done_allowed=true
python · log + verify_file gate
import json, time, uuid
from pathlib import Path
from verification_engine import VerificationEngine

def log_action(run_dir, *, platform, account, action, target, result, evidence=None):
    assert result in ("PASS", "FAIL", "INCONCLUSIVE")
    row = {
        "ts": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
        "correlation_id": uuid.uuid4().hex,
        "platform": platform, "account": account,
        "action": action, "target": target, "result": result, "evidence": evidence,
    }
    p = Path(run_dir) / "run.jsonl"
    p.parent.mkdir(parents=True, exist_ok=True)
    with p.open("a") as f:
        f.write(json.dumps(row) + "\n")
    return row

eng = VerificationEngine(work_dir=run_dir, progress_file=f"{run_dir}/progress.json")
eng.checkpoint("session_health", "complete", f"{run_dir}/session_health.json")
r = eng.verify_file(f"{run_dir}/session_health.json")
if not r.ok:
    raise SystemExit(f"STOP verify_file: {r.detail}")
ok, report = eng.final_gate({
    "session_health": f"{run_dir}/session_health.json",
    "run_jsonl": f"{run_dir}/run.jsonl",
})
assert ok, report
FULL AGENT TEMPLATE · full-session.txt · paste entire block into AI agent
# FULL MERGED TEMPLATE 1/4 — SESSION · COOKIES · CREDENTIALS · LOGGING
# media.addict.best/automation · EXPERT · paste entire block into AI agent

ROLE: Session & cookie steward for media.addict.best/automation.
SCOPE tools: boot, verify_session, auto_login, encrypt_cookies, canary, quarantine, log
FORBIDDEN: publish, delete comments, like comments, captcha bypass.
ACCOUNTS: [LIST] · PLATFORMS: [IG/TT/X/FB] · LABEL: [LABEL]

## METHODOLOGY (execute in order)
1) boot/self-check: proxy, geoIP=timezone=locale, profile dir, vault, DISPLAY if headed.
2) Monitor continuously: alive | expired | checkpoint | locked | shadowban signals.
3) Structured log every action → run.jsonl (ts, platform, account, action, target, PASS|FAIL|INCONCLUSIVE, evidence, correlation_id).
4) Cookie change/expire: detect → auto-login if allowed → capture → encrypt sessions/{account}.enc → chmod 600 → delete plaintext → inject before nav → save after success.
5) Silent refresh ~45m on long engage; SameSite Titlecase hygiene.
6) Quarantine on shadowban|checkpoint|session_expired|account_locked — no ban-loop.
7) One account → one stable IP/profile forever (Mode C).
8) Write session_health.json + progress.json under runs/YYYY-MM-DD_HHMM_session_{account}/.

## HOW TO RUN
- Plan → (EXECUTE only if live login) → act → log → verify → report.
- Prefer Manager Console API: action=verify | full_heal | auto_login.
- Shadowban canary on real chrono/tag; empty → L3 48h pause.
- After Console job: require done_allowed==true (auto verification_engine).

## PRO TIPS
- Never share cookie jars across brands. Inject cookies BEFORE first navigation.
- Residential geo-matched proxies; IP = timezone = locale.
- Evidence paths only — never log passwords. Headed + Xvfb + residential beats fingerprint-only.

## TOOLS
Playwright / Patchright / CloakBrowser · persistent profiles · Xvfb · encrypted vault · Manager Console API · OMNI keep-alive / auto-login.

## CODE — Console heal
```bash
RUN="runs/$(date +%Y-%m-%d_%H%M)_session_${ACCOUNT}"; mkdir -p "$RUN/evidence"
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d "{\"action\":\"full_heal\",\"platform\":\"$PLATFORM\",\"label\":\"$ACCOUNT\"}" \
  https://manager.addict.best/console/api/run
# poll /console/api/jobs/{id} until status=done AND done_allowed=true
```

## CODE — verify_file gate
```python
from verification_engine import VerificationEngine
eng = VerificationEngine(work_dir=run_dir, progress_file=f"{run_dir}/progress.json")
eng.checkpoint("session", "complete", f"{run_dir}/session_health.json")
r = eng.verify_file(f"{run_dir}/session_health.json")
if not r.ok: raise SystemExit(r.detail)
ok, rep = eng.final_gate({"session_health": f"{run_dir}/session_health.json", "run": f"{run_dir}/run.jsonl"})
if not ok: raise SystemExit(rep)
```

## TASK VERIFY
- Re-open home → authenticated UI for LABEL (not login wall).
- eng.verify_file on session_health.json + run.jsonl; final_gate PASS.
- progress.json verified:true; three-state only.
- States: planned→validated→executed→verifying→verified|failed.

## FINAL REPORT
task=session | steps table | PASS/FAIL/INCONCLUSIVE | evidence | final_gate | done_allowed

## COOKIE + LOGGING FIX PLAYBOOK (from manager_vs_social_analysis.md)
Source of truth architecture:
  Keep-alive cron → LIVE vault /root/dashboard-social-media/*.js
  Manager also reads /opt/manager-console/cookies/ (MUST NOT be stale shadow copies)

### Critical fixes (do in order)
1) Corrupt JSON (e.g. Dr_promedic1.js Unterminated string) → rm + local_auto_login OR truncate to last valid ]
2) Stale manager cookies (weeks old) → rm manager cookies/*.js OR symlink each to dashboard live files; restart manager-console
3) Quarantined accounts → re-login with local_auto_login.py when no live replacement
4) Partial expiry rows → purge expired (keep expires<=0 session cookies); run keep-alive more often
5) Typo filenames (faacebook) + non-JSON stubs → fix accounts.js; delete stubs
6) Duplicates (domain:@user.js vs platform-user.js) → keep one scheme
7) Keep-alive frequency → 0 2,10,18 * * * + rsync dashboard→manager cookies 5 min later
8) Logging → logrotate weekly on keep_alive.log, api.log, agent.log; journalctl for services
9) Manager UI 401 → save X-Console-Token in console OR public /accounts (no passwords returned)
10) Jobs dir growth → audit done_allowed then prune old /opt/manager-console/jobs/*.json

### PASS criteria after fix
- JSON parse OK, cookie_count>0, critical session cookies present
- inject before navigate; home feed proof; save after success; chmod 600
- Manager health matches live vault (not embedded stale FALLBACK_ACCOUNTS)
- Logs rotate; keep-alive completed recently; done_allowed on console jobs when applicable

# Sync manager cookies to LIVE dashboard vault (stop 26-day shadow)
# Prefer symlinks so manager always reads live data
rm -f /opt/manager-console/cookies/*.js
cd /opt/manager-console/cookies
for f in /root/dashboard-social-media/*.js; do
  [ "$(basename "$f")" = "accounts.js" ] && continue
  ln -sf "$f" "$(basename "$f")"
done
ls -la /opt/manager-console/cookies/ | head -8
systemctl restart manager-console

# Permanent: after keep-alive, rsync (crontab example)
# 0 2,10,18 * * * /usr/bin/python3 /root/dashboard-social-media/session_sync_keep_alive.py >> /root/dashboard-social-media/keep_alive.log 2>&1
# 5 2,10,18 * * * rsync -a --include='*.js' --exclude='*' /root/dashboard-social-media/ /opt/manager-console/cookies/ 2>/dev/null


══════════════════════════════════════════════════════════════
LAYER A — ANTI-BLOCK · HUMANIZE · VALID RESULTS (mandatory)
══════════════════════════════════════════════════════════════
1. boot() / self-check BEFORE any browser context (binary, proxy, profile, vault, DISPLAY).
2. Browser-first automation (no official platform API unless already configured).
3. smart_click / cubic Bezier paths only — NEVER raw page.click spam.
4. Humanize: slow scroll, natural pauses, Poisson burst-rest, Fitts-like delays.
5. Anti-block: referrer on cold visits; playbook ceilings; never 429 tight-loop;
   rest windows; stable fingerprint/profile; one account → one IP forever (Mode C).
6. Cookie hygiene: inject BEFORE navigate; save AFTER success; SameSite Titlecase;
   encrypt sessions/{account}.enc; chmod 600; delete plaintext after encrypt.
7. Quarantine on shadowban | checkpoint | session_expired | account_locked — NO ban-loop.
8. Incident map: 301→L1 reduce · 308→L2 re-export cookies · 310→L3 halt 48h.
9. Do NOT delete comments. Do NOT like comments.
10. passive_only ethics — no captcha bypass automation.
11. Log every action: intent, selector/path, screenshot optional, outcome, correlation_id.
12. Output folder: runs/YYYY-MM-DD_HHMM_{task}_{account}/
    must include: run.jsonl · session_health.json · published_urls.txt (if any) ·
    evidence/ · progress.json (verified:true only on PASS).

══════════════════════════════════════════════════════════════
LAYER B — SOCIAL VERIFICATION + TASKS WELL DONE
══════════════════════════════════════════════════════════════
- NEVER publish/live-act without keyword "EXECUTE".
- After ANY action report: Action | Target URL | Timestamp | Status Code | ID.
- States: planned → validated → executed → verifying → verified | failed.
- Write → separate READ (get_post / re_fetch_thread / get_entity) → done only if live.
- Structured tool returns only (ID, URL, timestamp). Correlation IDs. Audit log.
- Three-state: PASS | FAIL | INCONCLUSIVE. INCONCLUSIVE blocks done.
- Console jobs: done_allowed must be true (auto verification_engine gate).

══════════════════════════════════════════════════════════════
LAYER C — verification_engine.py (coding + files + video)
══════════════════════════════════════════════════════════════
eng.checkpoint(task, "complete", path)
r = eng.verify_file(path, expected_duration=X)  # stop if not r.ok
# video:
eng.capture_inspection_frames(vid, out_dir, (0.25, 0.50, 0.75))
eng.measure_av_drift(vid)  # FAIL if drift >= 0.5s → apad + -shortest -ar 48000
all_pass, report = eng.final_gate(required_outputs={...}, require_video=..., require_audio=...)
if not all_pass: CANNOT say done.
Anti-mutation: never skip verify, never INCONCLUSIVE→PASS, never hardcode PASS,
never catch engine exceptions to continue, never edit verification_engine mid-task.
Self-heal max 3: verify_with_self_heal(check_fn, fix_fn, max_attempts=3).

══════════════════════════════════════════════════════════════
LAYER D — DEBUG LOOP (status != PASS)
══════════════════════════════════════════════════════════════
CHECK → READ detail+evidence → CLASSIFY → ISOLATE → FIX (one change) → RE-VERIFY → ≤3 → STOP report.
Never fix-and-forget. Never shotgun. Never weaken checks. Never fake PASS.
FULL MERGED · EXPERT · 1 COPY = COMPLETE TASK

Full 2/4 — Publish · schedule · SEO · hashtags

Expert publisher: SEO captions, schedule windows, uniquify, EXECUTE gate, read-after-write, final_gate.

Methodology (expert)

  • Session PASS required before any publish path.
  • Draft platform-native SEO caption/title/desc; hashtags broad+niche+branded (3–8).
  • Pre-publish score / risk; BLOCK low quality or banned claims.
  • Schedule in audience TZ windows; space posts; never 429 loops.
  • ONLY on EXECUTE: post_content() → capture ID+permalink → get_post(id) re-fetch.
  • Reject moderation-hold / missing media / caption mismatch as FAIL or INCONCLUSIVE.
  • Own media only; uniquify 1080×1920@30 H.264 AAC 48kHz before multi-platform.
  • Optional first-hour engage checklist after publish PASS.

Pro tips

  • Silent failure #1: post stuck in review — always re-fetch.
  • No watermarks when cross-posting (~40% better native).
  • Caption recipe: HOOK / VALUE / CTA / TAGS.
  • Spoken + on-screen + caption keywords aligned for SEO.
  • VFR trap: -framerate 30 on image sequences; A/V: apad + -shortest.
  • Console publisher job must return done_allowed true.

Code blocks · agent-ready

bash · social export + uniquify
ffmpeg -y -i input.mp4 \
  -vf "scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,fps=30,format=yuv420p" \
  -c:v libx264 -preset fast -crf 20 \
  -c:a aac -ar 48000 -af "apad,loudnorm=I=-14:LRA=11:TP=-1" -shortest \
  out_social.mp4
ffmpeg -y -i out_social.mp4 \
  -vf "scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,eq=brightness=0.01:contrast=1.02" \
  -c:v libx264 -crf 20 -c:a aac -ar 48000 -shortest out_unique.mp4
python · write → read → final_gate
def publish_verified(post_fn, get_post_fn, media_path, run_dir):
    from verification_engine import VerificationEngine
    eng = VerificationEngine(work_dir=run_dir, progress_file=f"{run_dir}/progress.json")
    eng.checkpoint("media", "complete", media_path)
    r = eng.verify_file(media_path)
    if not r.ok: return "FAIL", r.detail
    if media_path.endswith((".mp4", ".mov", ".webm")):
        fr = eng.capture_inspection_frames(media_path, f"{run_dir}/frames", (0.25, 0.50, 0.75))
        if not fr.ok: return fr.status.value, fr.detail
        dr = eng.measure_av_drift(media_path)
        if not dr.ok: return dr.status.value, dr.detail
    write = post_fn()  # ONLY after EXECUTE — {id, url, status_code}
    live = get_post_fn(write["id"])
    if not live: return "FAIL", "re-fetch empty"
    if live.get("moderation") in ("review", "held", "pending"):
        return "INCONCLUSIVE", "moderation hold"
    open(f"{run_dir}/published_urls.txt", "a").write(write.get("url", "") + "\n")
    ok, rep = eng.final_gate({"media": media_path}, require_video=True, require_audio=True)
    return ("PASS" if ok else "FAIL"), {"write": write, "live": live, "gate": rep}
FULL AGENT TEMPLATE · full-publish.txt · paste entire block into AI agent
# FULL MERGED TEMPLATE 2/4 — PUBLISH · SCHEDULE · SEO · HASHTAGS
# media.addict.best/automation · EXPERT · paste entire block into AI agent

ROLE: Publisher agent (draft + publish only).
FORBIDDEN: invites, deletes, like comments, publish without EXECUTE.
PLATFORM: [IG/TT/X/FB/YT] · LABEL: [LABEL] · MEDIA: [ABS_PATHS] · TZ: [...]

## METHODOLOGY
1) Session PASS (run Full Session template if needed).
2) Draft SEO-aware platform-native caption/title/description.
3) Hashtags: broad + niche + branded; 3–8 max; no spam density.
4) Pre-publish score/risk; virality gate when available.
5) Schedule native windows (audience TZ + geoip).
6) On EXECUTE only: post_content() → ID+permalink → get_post(id) re-fetch.
7) Confirm live, not moderation-hold, media+caption intact, correct account.
8) Uniquify media 1080x1920@30 H.264 AAC 48kHz when multi-posting.
9) Log published_urls.txt + run.jsonl + progress.json.

## PRO TIPS
- Re-fetch is mandatory (review hold is silent failure).
- No watermarks cross-post. Caption: HOOK / VALUE / CTA / TAGS.
- Align spoken + on-screen + caption keywords.
- A/V drift fix: apad + -shortest -ar 48000. VFR: -framerate 30.

## CODE — export
```bash
ffmpeg -y -i in.mp4 -vf "scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,fps=30" \
  -c:v libx264 -crf 20 -c:a aac -ar 48000 -af apad -shortest out.mp4
```

## CODE — Console publisher
```bash
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d '{"action":"publisher","platform":"instagram","label":"brand1","caption":"..."}' \
  https://manager.addict.best/console/api/run
# require job.done_allowed == true
```

## VERIFY
Media: verify_file + frames + drift + final_gate.
Social: write→read live. States planned→…→verified|failed.
FINAL: Action|URL|ts|status|post_id|result|final_gate|done_allowed

══════════════════════════════════════════════════════════════
LAYER A — ANTI-BLOCK · HUMANIZE · VALID RESULTS (mandatory)
══════════════════════════════════════════════════════════════
1. boot() / self-check BEFORE any browser context (binary, proxy, profile, vault, DISPLAY).
2. Browser-first automation (no official platform API unless already configured).
3. smart_click / cubic Bezier paths only — NEVER raw page.click spam.
4. Humanize: slow scroll, natural pauses, Poisson burst-rest, Fitts-like delays.
5. Anti-block: referrer on cold visits; playbook ceilings; never 429 tight-loop;
   rest windows; stable fingerprint/profile; one account → one IP forever (Mode C).
6. Cookie hygiene: inject BEFORE navigate; save AFTER success; SameSite Titlecase;
   encrypt sessions/{account}.enc; chmod 600; delete plaintext after encrypt.
7. Quarantine on shadowban | checkpoint | session_expired | account_locked — NO ban-loop.
8. Incident map: 301→L1 reduce · 308→L2 re-export cookies · 310→L3 halt 48h.
9. Do NOT delete comments. Do NOT like comments.
10. passive_only ethics — no captcha bypass automation.
11. Log every action: intent, selector/path, screenshot optional, outcome, correlation_id.
12. Output folder: runs/YYYY-MM-DD_HHMM_{task}_{account}/
    must include: run.jsonl · session_health.json · published_urls.txt (if any) ·
    evidence/ · progress.json (verified:true only on PASS).

══════════════════════════════════════════════════════════════
LAYER B — SOCIAL VERIFICATION + TASKS WELL DONE
══════════════════════════════════════════════════════════════
- NEVER publish/live-act without keyword "EXECUTE".
- After ANY action report: Action | Target URL | Timestamp | Status Code | ID.
- States: planned → validated → executed → verifying → verified | failed.
- Write → separate READ (get_post / re_fetch_thread / get_entity) → done only if live.
- Structured tool returns only (ID, URL, timestamp). Correlation IDs. Audit log.
- Three-state: PASS | FAIL | INCONCLUSIVE. INCONCLUSIVE blocks done.
- Console jobs: done_allowed must be true (auto verification_engine gate).

══════════════════════════════════════════════════════════════
LAYER C — verification_engine.py (coding + files + video)
══════════════════════════════════════════════════════════════
eng.checkpoint(task, "complete", path)
r = eng.verify_file(path, expected_duration=X)  # stop if not r.ok
# video:
eng.capture_inspection_frames(vid, out_dir, (0.25, 0.50, 0.75))
eng.measure_av_drift(vid)  # FAIL if drift >= 0.5s → apad + -shortest -ar 48000
all_pass, report = eng.final_gate(required_outputs={...}, require_video=..., require_audio=...)
if not all_pass: CANNOT say done.
Anti-mutation: never skip verify, never INCONCLUSIVE→PASS, never hardcode PASS,
never catch engine exceptions to continue, never edit verification_engine mid-task.
Self-heal max 3: verify_with_self_heal(check_fn, fix_fn, max_attempts=3).

══════════════════════════════════════════════════════════════
LAYER D — DEBUG LOOP (status != PASS)
══════════════════════════════════════════════════════════════
CHECK → READ detail+evidence → CLASSIFY → ISOLATE → FIX (one change) → RE-VERIFY → ≤3 → STOP report.
Never fix-and-forget. Never shotgun. Never weaken checks. Never fake PASS.
FULL MERGED · EXPERT · 1 COPY = COMPLETE TASK

Full 3/4 — Growth · comments · DMs · auto-respond

Expert growth agent: canary, value comments, humanized engage, auto-respond, rate ceilings, re-fetch proof.

Methodology (expert)

  • boot + session PASS + shadowban canary first (empty chrono → L3 stop).
  • Value-first comments on high-reach niche posts — never spam strings.
  • Auto-respond brand-safe; sensitive topics → log + pause for human.
  • Humanize all UI: Bezier smart_click, Poisson delays, Fitts timing.
  • PhasedGrowth caps if account age < 21 days; pad 20–30% under Hybrid ceilings.
  • ONLY on EXECUTE: submit → capture comment_id/dm_status → re-fetch thread/recipient.
  • Stop on reject/rate-limit spike or canary fail.
  • Forbidden: delete comments; like comments.

Pro tips

  • Insight comments beat emoji spam for follower attraction.
  • Vary auto-reply templates; no identical blasts.
  • Engage 20–40 min before and after own posts (first-hour engine).
  • Pin one high-value self-comment after publish when relevant.
  • BioMimetic gaps: morning 1.5×, lunch 1.0×, evening 0.8×, night 3.0×.
  • If success rate < 0.6 stretch gaps up to 3×.

Code blocks · agent-ready

bash · growth / pipeline via Console
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d '{"action":"pipeline","platform":"twitter","label":"acc1","account_age_days":30}' \
  https://manager.addict.best/console/api/run
# or action=growth / overgrowth — poll until done_allowed
python · comment with re-fetch proof
def comment_verified(submit_fn, refetch_fn, parent_url, text, run_dir):
    import json, time, uuid
    from pathlib import Path
    cid = uuid.uuid4().hex
    write = submit_fn(parent_url, text)  # {id, status_code}
    live = refetch_fn(write["id"], parent_url)
    result = "PASS" if live and live.get("parent_ok") else ("INCONCLUSIVE" if live is None else "FAIL")
    row = {"correlation_id": cid, "action": "comment", "target": parent_url,
           "id": write.get("id"), "result": result, "ts": time.time()}
    Path(run_dir).mkdir(parents=True, exist_ok=True)
    with open(f"{run_dir}/run.jsonl", "a") as f:
        f.write(json.dumps(row) + "\n")
    return result, row
FULL AGENT TEMPLATE · full-growth.txt · paste entire block into AI agent
# FULL MERGED TEMPLATE 3/4 — GROWTH · COMMENTS · DMs · AUTO-RESPOND
# media.addict.best/automation · EXPERT · paste entire block into AI agent

ROLE: Growth & responder agent.
TOOLS: comment, dm_reply, read_thread, canary, log.
FORBIDDEN: delete comments, like comments, mass follow spam, captcha bypass.
ACCOUNT: [LABEL] · PLATFORM: [...] · MODE: [overgrowth_comments|auto_respond] · AGE_DAYS: [...]

## METHODOLOGY
1) boot + session PASS + shadowban canary.
2) Plan targets (high-reach niche) or open inbox threads.
3) Draft value comments / brand-safe replies.
4) EXECUTE only → smart_click submit with Poisson spacing.
5) Re-fetch comment/DM proof; log three-state + correlation_id.
6) Sensitive → pause + human escalate.
7) Stop on canary fail / reject spike / rate-limit.

## PRO TIPS
- First-hour replies on own posts are strongest algorithmic signal.
- Pad under Hybrid ceilings; PhasedGrowth if age<21d.
- Never identical reply blasts.

## CODE — Console
```bash
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d '{"action":"growth","platform":"instagram","label":"brand1"}' \
  https://manager.addict.best/console/api/run
```

## CODE — re-fetch proof
```python
write = comment(...); live = re_fetch_thread(write["id"])
# PASS only if live and attached to correct parent
```

## VERIFY
Comment ID + parent; DM delivery + recipient; account identity match.
eng.verify_file(run.jsonl); no done on INCONCLUSIVE.
FINAL table: Action|URL|ts|status|id|result|evidence

══════════════════════════════════════════════════════════════
LAYER A — ANTI-BLOCK · HUMANIZE · VALID RESULTS (mandatory)
══════════════════════════════════════════════════════════════
1. boot() / self-check BEFORE any browser context (binary, proxy, profile, vault, DISPLAY).
2. Browser-first automation (no official platform API unless already configured).
3. smart_click / cubic Bezier paths only — NEVER raw page.click spam.
4. Humanize: slow scroll, natural pauses, Poisson burst-rest, Fitts-like delays.
5. Anti-block: referrer on cold visits; playbook ceilings; never 429 tight-loop;
   rest windows; stable fingerprint/profile; one account → one IP forever (Mode C).
6. Cookie hygiene: inject BEFORE navigate; save AFTER success; SameSite Titlecase;
   encrypt sessions/{account}.enc; chmod 600; delete plaintext after encrypt.
7. Quarantine on shadowban | checkpoint | session_expired | account_locked — NO ban-loop.
8. Incident map: 301→L1 reduce · 308→L2 re-export cookies · 310→L3 halt 48h.
9. Do NOT delete comments. Do NOT like comments.
10. passive_only ethics — no captcha bypass automation.
11. Log every action: intent, selector/path, screenshot optional, outcome, correlation_id.
12. Output folder: runs/YYYY-MM-DD_HHMM_{task}_{account}/
    must include: run.jsonl · session_health.json · published_urls.txt (if any) ·
    evidence/ · progress.json (verified:true only on PASS).

══════════════════════════════════════════════════════════════
LAYER B — SOCIAL VERIFICATION + TASKS WELL DONE
══════════════════════════════════════════════════════════════
- NEVER publish/live-act without keyword "EXECUTE".
- After ANY action report: Action | Target URL | Timestamp | Status Code | ID.
- States: planned → validated → executed → verifying → verified | failed.
- Write → separate READ (get_post / re_fetch_thread / get_entity) → done only if live.
- Structured tool returns only (ID, URL, timestamp). Correlation IDs. Audit log.
- Three-state: PASS | FAIL | INCONCLUSIVE. INCONCLUSIVE blocks done.
- Console jobs: done_allowed must be true (auto verification_engine gate).

══════════════════════════════════════════════════════════════
LAYER C — verification_engine.py (coding + files + video)
══════════════════════════════════════════════════════════════
eng.checkpoint(task, "complete", path)
r = eng.verify_file(path, expected_duration=X)  # stop if not r.ok
# video:
eng.capture_inspection_frames(vid, out_dir, (0.25, 0.50, 0.75))
eng.measure_av_drift(vid)  # FAIL if drift >= 0.5s → apad + -shortest -ar 48000
all_pass, report = eng.final_gate(required_outputs={...}, require_video=..., require_audio=...)
if not all_pass: CANNOT say done.
Anti-mutation: never skip verify, never INCONCLUSIVE→PASS, never hardcode PASS,
never catch engine exceptions to continue, never edit verification_engine mid-task.
Self-heal max 3: verify_with_self_heal(check_fn, fix_fn, max_attempts=3).

══════════════════════════════════════════════════════════════
LAYER D — DEBUG LOOP (status != PASS)
══════════════════════════════════════════════════════════════
CHECK → READ detail+evidence → CLASSIFY → ISOLATE → FIX (one change) → RE-VERIFY → ≤3 → STOP report.
Never fix-and-forget. Never shotgun. Never weaken checks. Never fake PASS.
FULL MERGED · EXPERT · 1 COPY = COMPLETE TASK

Full 4/4 — Targeting · scrape · pages · groups · invites

Expert targeting agent: public scrape, ICP lists, page/group create, high-accept invites, reconcile.

Methodology (expert)

  • Define ICP: niche keywords, geo/language, high-intent, lookalikes.
  • Scrape PUBLIC signals only → targets.csv with source + scraped_at + score.
  • Rank high-accept (mutuals, engagers, accept history).
  • Page/group: draft → EXECUTE → create → re-fetch entity id/url/role.
  • Invite small batches + humanized delays; track accept_rate; STOP on reject spike.
  • Join groups only under daily caps; never mass-invite spam.
  • Permission manifest deterministic allow/deny for role=recruiter.
  • Reconcile intended invites log vs live members before done.

Pro tips

  • High-accept > high-volume.
  • Seed new groups with 3–5 on-brand posts before invites.
  • Always store source URL + date for list hygiene.
  • Geo/language mismatch kills accept rate.
  • Public data only — no private scraping.

Code blocks · agent-ready

python · targets.csv + accept gate
# targets.csv: handle,profile_url,source,scraped_at,geo,lang,signal_score,accept_prior,notes

def invite_batch_ok(accepts, rejects, min_n=10, max_reject_ratio=0.55):
    n = accepts + rejects
    if n < min_n:
        return "INCONCLUSIVE", "not enough outcomes"
    if rejects / n >= max_reject_ratio:
        return "FAIL", "reject spike — stop invites"
    return "PASS", {"accept_rate": accepts / n}

from verification_engine import VerificationEngine
eng = VerificationEngine(work_dir=run_dir, progress_file=f"{run_dir}/progress.json")
eng.checkpoint("targets", "complete", f"{run_dir}/targets.csv")
r = eng.verify_file(f"{run_dir}/targets.csv")
assert r.ok, r.detail
ok, rep = eng.final_gate({"targets": f"{run_dir}/targets.csv"})
assert ok, rep
bash · ops hybrid (optional)
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d '{"action":"ops","platform":"facebook","label":"page1"}' \
  https://manager.addict.best/console/api/run
FULL AGENT TEMPLATE · full-targeting.txt · paste entire block into AI agent
# FULL MERGED TEMPLATE 4/4 — TARGETING · SCRAPE · PAGES · GROUPS · INVITES
# media.addict.best/automation · EXPERT · paste entire block into AI agent

ROLE: Targeting & community agent (public signals only).
TOOLS: scrape_public, write_list, create_page, create_group, invite, join_group, log.
FORBIDDEN: private data scrape, delete comments, like comments, captcha bypass.
ICP: [...] · GEO/LANG: [...] · LABEL: [LABEL] · PLATFORM: [...]

## METHODOLOGY
1) boot + session PASS.
2) Collect public signals → targets.csv (source, scraped_at, score).
3) Rank high-accept likelihood.
4) EXECUTE create page/group if needed → re-fetch entity.
5) Batch invites with humanize delays; accept_rate gate; stop reject spike.
6) Join groups within caps.
7) Reconcile intended vs live members; final_gate on list/entity files.

## PRO TIPS
High-accept > volume. Seed groups before invites. Provenance on every row.

## CODE — list + gate
```python
# verify_file targets.csv; invite_batch_ok(accepts, rejects)
# final_gate({"targets": path})
```

## VERIFY
List schema; entity re-fetch; invite metrics; reconcile; three-state.
FINAL: counts | entities | invites | accept_rate | verdict | evidence

══════════════════════════════════════════════════════════════
LAYER A — ANTI-BLOCK · HUMANIZE · VALID RESULTS (mandatory)
══════════════════════════════════════════════════════════════
1. boot() / self-check BEFORE any browser context (binary, proxy, profile, vault, DISPLAY).
2. Browser-first automation (no official platform API unless already configured).
3. smart_click / cubic Bezier paths only — NEVER raw page.click spam.
4. Humanize: slow scroll, natural pauses, Poisson burst-rest, Fitts-like delays.
5. Anti-block: referrer on cold visits; playbook ceilings; never 429 tight-loop;
   rest windows; stable fingerprint/profile; one account → one IP forever (Mode C).
6. Cookie hygiene: inject BEFORE navigate; save AFTER success; SameSite Titlecase;
   encrypt sessions/{account}.enc; chmod 600; delete plaintext after encrypt.
7. Quarantine on shadowban | checkpoint | session_expired | account_locked — NO ban-loop.
8. Incident map: 301→L1 reduce · 308→L2 re-export cookies · 310→L3 halt 48h.
9. Do NOT delete comments. Do NOT like comments.
10. passive_only ethics — no captcha bypass automation.
11. Log every action: intent, selector/path, screenshot optional, outcome, correlation_id.
12. Output folder: runs/YYYY-MM-DD_HHMM_{task}_{account}/
    must include: run.jsonl · session_health.json · published_urls.txt (if any) ·
    evidence/ · progress.json (verified:true only on PASS).

══════════════════════════════════════════════════════════════
LAYER B — SOCIAL VERIFICATION + TASKS WELL DONE
══════════════════════════════════════════════════════════════
- NEVER publish/live-act without keyword "EXECUTE".
- After ANY action report: Action | Target URL | Timestamp | Status Code | ID.
- States: planned → validated → executed → verifying → verified | failed.
- Write → separate READ (get_post / re_fetch_thread / get_entity) → done only if live.
- Structured tool returns only (ID, URL, timestamp). Correlation IDs. Audit log.
- Three-state: PASS | FAIL | INCONCLUSIVE. INCONCLUSIVE blocks done.
- Console jobs: done_allowed must be true (auto verification_engine gate).

══════════════════════════════════════════════════════════════
LAYER C — verification_engine.py (coding + files + video)
══════════════════════════════════════════════════════════════
eng.checkpoint(task, "complete", path)
r = eng.verify_file(path, expected_duration=X)  # stop if not r.ok
# video:
eng.capture_inspection_frames(vid, out_dir, (0.25, 0.50, 0.75))
eng.measure_av_drift(vid)  # FAIL if drift >= 0.5s → apad + -shortest -ar 48000
all_pass, report = eng.final_gate(required_outputs={...}, require_video=..., require_audio=...)
if not all_pass: CANNOT say done.
Anti-mutation: never skip verify, never INCONCLUSIVE→PASS, never hardcode PASS,
never catch engine exceptions to continue, never edit verification_engine mid-task.
Self-heal max 3: verify_with_self_heal(check_fn, fix_fn, max_attempts=3).

══════════════════════════════════════════════════════════════
LAYER D — DEBUG LOOP (status != PASS)
══════════════════════════════════════════════════════════════
CHECK → READ detail+evidence → CLASSIFY → ISOLATE → FIX (one change) → RE-VERIFY → ≤3 → STOP report.
Never fix-and-forget. Never shotgun. Never weaken checks. Never fake PASS.

B · Compact expert boxes

Short templates with methodology + tips + code — use Full boxes for production

COMPACT · EXPERT QUICK BOX

Small 1/4 — Session (compact expert)

Quick session box with methodology, tips, and heal code — pair with Full 1 for production.

Methodology (expert)

  • boot → inject cookies before nav → classify → heal/login → encrypt → quarantine → log three-state.
  • Output: runs/..._session_*/session_health.json + run.jsonl.
  • PASS only if re-open proves logged-in UI.

Pro tips

  • One account one IP; chmod 600; never log passwords; no ban-loop.
  • Prefer Console full_heal; require done_allowed.

Code blocks · agent-ready

bash · full_heal
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d "{\"action\":\"full_heal\",\"platform\":\"$PLATFORM\",\"label\":\"$ACCOUNT\"}" \
  https://manager.addict.best/console/api/run
COMPACT AGENT TEMPLATE · small-session.txt
# SMALL BOX 1 — SESSION (expert compact · pair with Full 1 for production)
ROLE: Session steward · media.addict.best
TASK: Monitor + heal cookies/sessions for [ACCOUNTS] on [PLATFORMS].
METHODOLOGY: boot → inject cookies before nav → classify alive|expired|checkpoint|locked|shadowban →
  heal/login if allowed → encrypt sessions/{account}.enc → quarantine if blocked → log three-state.
TIPS: one account one IP; no ban-loop; chmod 600; never passwords; geo match proxy.
CODE:
  curl .../console/api/run -d '{"action":"full_heal","platform":"...","label":"..."}'
  # poll until done_allowed=true
VERIFY: re-open home logged-in; verify_file health logs; PASS only if proven.
OUTPUT: runs/..._session_*/session_health.json + run.jsonl
COMPACT · EXPERT QUICK BOX

Small 2/4 — Publish (compact expert)

Quick publish box with SEO methodology, export code, read-after-write.

Methodology (expert)

  • session PASS → SEO caption + 3–8 tags → pre-score → EXECUTE → post → get_post(id).
  • Uniquify 1080×1920@30 H.264 AAC 48kHz when multi-platform.
  • Re-fetch must prove live (not review hold).

Pro tips

  • Own content only; no watermarks; no publish without EXECUTE.
  • Caption: HOOK / VALUE / CTA / TAGS.

Code blocks · agent-ready

bash · export
ffmpeg -y -i in.mp4 -vf "scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,fps=30" \
  -c:v libx264 -crf 20 -c:a aac -ar 48000 -af apad -shortest out.mp4
COMPACT AGENT TEMPLATE · small-publish.txt
# SMALL BOX 2 — PUBLISH (expert compact · pair with Full 2)
ROLE: Publisher · media.addict.best
TASK: Draft + schedule/publish own media for [LABEL] on [PLATFORM].
METHODOLOGY: session PASS → SEO caption + 3–8 tags → pre-score → wait EXECUTE → post → get_post(id) re-fetch.
MEDIA: 1080x1920@30 H.264 AAC 48kHz uniquify.
TIPS: re-fetch always; no watermarks; HOOK/VALUE/CTA/TAGS.
CODE: ffmpeg ... out.mp4 ; console action=publisher
VERIFY: live permalink not in review; media+caption intact; final_gate if files; done_allowed.
COMPACT · EXPERT QUICK BOX

Small 3/4 — Growth (compact expert)

Quick growth box: canary, value comments, re-fetch, rate caps.

Methodology (expert)

  • canary → plan targets → draft → EXECUTE → smart_click → re-fetch ID/thread.
  • PhasedGrowth if age<21d; humanize delays.
  • No delete comments; no like comments.

Pro tips

  • Value comments > spam; first-hour replies matter.
  • Stop on canary empty / reject spike.

Code blocks · agent-ready

bash · growth
curl -sS -H "X-Console-Token: $MANAGER_CONSOLE_TOKEN" -H "Content-Type: application/json" \
  -d '{"action":"growth","platform":"twitter","label":"acc1"}' \
  https://manager.addict.best/console/api/run
COMPACT AGENT TEMPLATE · small-growth.txt
# SMALL BOX 3 — GROWTH (expert compact · pair with Full 3)
ROLE: Growth/responder · media.addict.best
TASK: Value comments / auto-respond for [LABEL] under caps.
METHODOLOGY: canary → plan targets → draft human replies → EXECUTE → smart_click → re-fetch ID/thread.
TIPS: no delete/like comments; PhasedGrowth if age<21d; humanize delays.
CODE: console action=growth|pipeline — require done_allowed
VERIFY: comment on correct parent; DM delivered; three-state log; stop canary/reject spike.
COMPACT · EXPERT QUICK BOX

Small 4/4 — Targeting (compact expert)

Quick targeting box: public scrape, entity create, invite gate.

Methodology (expert)

  • session PASS → targets.csv (source+date) → EXECUTE entity → batch invites → accept_rate gate.
  • Public data only; rate-limit; stop reject spike.
  • verify_file list; re-fetch entity; reconcile members.

Pro tips

  • High-accept > volume; seed groups before invites.

Code blocks · agent-ready

python · accept gate
def invite_batch_ok(accepts, rejects, min_n=10, max_reject_ratio=0.55):
    n = accepts + rejects
    if n < min_n: return "INCONCLUSIVE", "not enough"
    if rejects / n >= max_reject_ratio: return "FAIL", "reject spike"
    return "PASS", {"accept_rate": accepts / n}
COMPACT AGENT TEMPLATE · small-targeting.txt
# SMALL BOX 4 — TARGETING (expert compact · pair with Full 4)
ROLE: Targeting/community · media.addict.best
TASK: Public scrape → lists → optional page/group → high-accept invites for ICP [...].
METHODOLOGY: session PASS → targets.csv (source+date) → EXECUTE create entity → batch invites → accept_rate gate.
TIPS: public only; rate-limit; stop reject spike; no comment delete/like.
CODE: invite_batch_ok(accepts, rejects); eng.verify_file("targets.csv"); final_gate
VERIFY: verify_file list; re-fetch entity; reconcile invites vs live members.