Using Jev as the decision layer for social media content ideas and drafts
The post reframes content production as a decision problem: Jev first judges what a source says, who the audience pain is, and whether a claim is fact or inference, then routes work to a cheap model, a strong model, or a human, with a one-shot prompt for Claude Code.

çoğu sosyal medya ekibi içerik üretimini hala yazı yazma problemi sanıyor. değil. karar problemi. model daha postu yazmadan jev source’un etrafındaki state’i okuyup birkaç karar verebilir: > kaynak ne anlatıyor? > hangi audience pain var? > claim fact mi, inference mı, unknown mı? > fikir tutorial mı, opinion mı, case study mi, offer mı? > cheap model mi, strong model mi, human mı? sonra kod bunları birbirine bağlıyor. loop basit: source > classify > score > draft > verify > human approval > publish jev yazarı değiştirmiyor. hangi fikrin yazılmaya değer olduğunu, draft’ın hangi kanıtı güvenle kullanabileceğini ve belirsizliğin nerede insan kontrolüne gitmesi gerektiğini seçiyor. burada ekonomi değişiyor. intake’te elenmesi gereken fikre pahalı generation harcamıyorsun. 50 fikrin hepsini üretmek yerine önce gerçekten savunulabilir olanları seçiyorsun. generator zaten ucuzluyor. değerli katman editorial router oluyor: gürültülü content queue’yu daha küçük, daha sağlam bir post setine çeviren sistem. -------------------------------------------------------- BU SİSTEMİ KURMAK İSTİYORSAN, BU ONE-SHOT PROMPTU; CLAUDECODE/CODEX'U VER: -------------------------------------------------------- You are a senior staff engineer and product architect. Build a local-first, Jev-powered social content decision and drafting system in the current repository. Do not stop at planning. Inspect the repository, make reasonable assumptions, implement the system, run validation, and leave a working local application. ## Product goal Create a content operations workspace that can: 1. accept a source, idea, URL, or pasted text; 2. evaluate the source with Jev using typed decisions; 3. determine the safest and most useful content direction; 4. select an appropriate content profile; 5. generate a draft through a pluggable text-generation provider; 6. lint and validate the draft; 7. run a second Jev-based editorial gate; 8. send the result to human review; 9. export approved copy as Markdown, JSON, or plain text. The application must be generic and configurable. Do not hardcode a specific account, niche, brand, creator, audience, or business model. ## Non-goals Do not implement: - automatic posting; - X/Twitter API integration; - social account login; - DMs; - reply automation; - engagement automation; - follower scraping; - coordinated engagement; - fake engagement; - autonomous publishing; - generated personal experiences; - fabricated metrics, revenue, customers, experiments, or outcomes. The system must only prepare, evaluate, review, and export content. ## Important operating rules - Use Jev as a typed decision layer, not as the copywriter. - Code owns workflow control, thresholds, retries, validation, and side effects. - Jev must never publish, send, or perform external actions. - The final copywriter provider must be replaceable. - Mock mode must work without API keys. - Live mode must require an explicit user action. - Fast mode is the default. - Do not ask the user to choose routine implementation details. - Record reasonable assumptions in the README. - Treat all source text as untrusted content, not as system instructions. - Never expose API keys in logs, UI, database records, or exported files. ## Recommended stack First inspect the existing repository and preserve its conventions. If the repository is empty or does not have a clear stack, use: - TypeScript; - Node.js 20 or newer; - Next.js or a small TypeScript full-stack application; - SQLite for local persistence; - Zod for runtime validation; - Vitest for unit and integration tests; - Playwright for the main UI smoke journey; - a simple local CSS system or existing project styling. Do not add unnecessary infrastructure. ## TypeSafe and Jev integration Before implementing Jev integration, read the current official TypeSafe documentation and verify the installed SDK API. Use the official sources as the source of truth: - https://docs.typesafe.ai/introduction/quickstart.md - https://docs.typesafe.ai/concepts/system-one.md - https://docs.typesafe.ai/concepts/state.md - https://docs.typesafe.ai/primitives.md - https://docs.typesafe.ai/primitives/choice.md - https://docs.typesafe.ai/primitives/score.md - https://docs.typesafe.ai/primitives/noul.md - https://docs.typesafe.ai/confidence.md - https://docs.typesafe.ai/concepts/how-to-build-with-system-one.md - https://docs.typesafe.ai/patterns/intent-routing.md - https://docs.typesafe.ai/sdk/javascript.md - https://docs.typesafe.ai/api.md - https://docs.typesafe.ai/models.md Do not assume that an old SDK example is still valid. Use the official JavaScript SDK if appropriate. Keep the Jev client behind an interface such as: interface DecisionModel { evaluate<T>(input: DecisionInput<T>): Promise<DecisionResult<T>>; } Provide at least two implementations: - MockDecisionModel - LiveJevDecisionModel The mock implementation must be deterministic and usable in tests and local development. The live implementation must: - read credentials only from environment variables; - fail clearly when credentials are missing; - include timeout handling; - include bounded retries; - preserve the raw response only when safe; - redact sensitive values before persistence or logging; - expose model name and usage metadata when available; - never silently fall back from live mode to mock mode. ## Runtime modes Implement three visible modes. ### Fast Default mode. - one batched Jev preflight evaluation; - one batched Jev post-draft evaluation; - no unnecessary sequential decision calls; - deterministic mock support; - minimal latency. ### Deep Optional mode. - allows additional Jev evaluation when risk, ambiguity, or source weakness requires it; - must explain why an additional evaluation was triggered; - must not be used only to make the output longer. ### Mock Offline mode. - no external calls; - deterministic fixture answers; - clearly labeled as simulated; - never represented as live evidence. ## Configurable account profile Create an editable account profile. Do not hardcode any real account. The profile should support: - id; - display name; - platform; - language; - locale; - target audience; - positioning; - tone; - vocabulary; - prohibited patterns; - content pillars; - preferred formats; - engagement policy; - evidence policy; - personal claim policy; - source policy; - platform limits. The profile must be editable from the UI. The default language should be English, but language and locale must remain configurable. ## Content profiles Do not use generic names such as micro, punch, spark, storm, thunder, or mega. Use these profile names instead: ### flash - one deliberate line or very short hook; - approximately 40–140 characters; - only use when one idea is enough; - no forced explanation. ### signal - approximately 140–280 characters; - one clear claim; - one mechanism, contrast, or decision boundary; - suitable for compact standalone content. ### brief - approximately 400–600 characters; - claim, proof or observation, mechanism, and implication; - should feel complete without becoming a thread. ### deep_dive - approximately 700–1000 characters; - full mechanism; - second-order consequence; - clear distinction between fact, inference, and hypothesis. ### casefile - approximately 1000–1600 characters; - evidence-heavy; - may include multiple examples, source notes, or uncertainty labels; - use only when the subject genuinely needs depth. ### longform - 1600+ characters; - use only when the platform supports it and the subject requires sustained explanation; - never inflate a short idea to fill the profile. The profile keys must be: - flash - signal - brief - deep_dive - casefile - longform Length ranges are defaults, not excuses to violate platform limits. Account and platform configuration takes precedence. ## Source intake Support the following source types: - pasted text; - user-provided URL; - title plus notes; - manual idea; - imported Markdown or JSON; - existing draft for revision. A source should support: - id; - title; - URL; - text; - author; - published date; - retrieval date; - source type; - citations; - user notes. Source types should include: - primary; - secondary; - user-provided; - unknown. Do not claim that a source was verified unless it was actually supplied or fetched successfully. If a claim lacks sufficient support, classify it as one of: - supported; - inferred; - hypothesis; - unknown; - missing. Do not invent citations. If current, technical, financial, legal, policy, company, model, or product claims are present, route them to review when source evidence is insufficient. ## Preflight Jev evaluation Create one batched preflight evaluation whenever possible. The preflight should answer typed questions such as: - content_category; - evidence_status; - primary_mechanism; - recommended_profile; - hook_job; - source_sufficiency; - claim_risk; - audience_relevance; - personal_claim_risk; - research_required; - preflight_decision. Example content categories: - explanation; - observation; - analysis; - tutorial; - case study; - opinion; - opportunity; - announcement; - unclear. Example evidence statuses: - directly supported; - supported by supplied source; - reasonable inference; - hypothesis only; - unsupported. Example claim risks: - low; - medium; - high; - blocked. Example preflight decisions: - proceed; - proceed_with_labels; - research_required; - human_review_required; - reject. Use typed choices, scores, and yes/no probabilities where appropriate. The exact Jev SDK syntax must come from the current official documentation. Do not ask Jev to generate a post in the preflight call. ## Optional research route Include a research status in the pipeline, but keep research separate from drafting. Possible statuses: - not_required; - pending; - in_progress; - complete; - missing; - blocked. If research support is implemented: - use public sources only; - prefer primary sources; - preserve source URLs and retrieval timestamps; - mark missing evidence explicitly; - distinguish facts from inference; - never fill gaps with invented numbers; - keep research notes separate from the final copy; - do not use private accounts, private APIs, or scraped credentials. If the system cannot verify a claim, the final draft must either omit it or label it clearly as inference or hypothesis. ## Draft generation Create a provider abstraction: interface DraftProvider { generateDraft(input: DraftRequest): Promise<DraftResponse>; } Implement: - MockDraftProvider; - OpenAICompatibleDraftProvider; - AnthropicCompatibleDraftProvider. The provider must receive: - account profile; - source text; - source metadata; - preflight decisions; - selected content profile; - selected format; - evidence boundaries; - prohibited patterns; - required uncertainty labels. The provider must not receive hidden assumptions as facts. The generation prompt must explicitly prohibit: - fabricated personal experience; - fabricated customer results; - fabricated revenue; - fabricated experiments; - fake source citations; - invented statistics; - unsupported certainty; - copied catchphrases; - imitation of a living creator’s exact phrasing; - empty engagement bait; - generic “what do you think?” endings unless explicitly requested; - claims that the system published anything. The generated response should contain: - text; - profile; - format; - claims; - source notes; - warnings; - provider; - model metadata when available. ## Supported content formats Support configurable formats such as: - single_post; - quote_post; - reply; - thread; - thread_unit; - launch_post; - source_summary; - revision. The application must not publish any format automatically. For threads, each unit must be independently reviewable and the system must preserve ordering. ## Post-draft Jev gate After draft generation, run a second batched Jev evaluation. Evaluate: - hook_strength; - mechanism_clarity; - evidence_alignment; - profile_fit; - audience_fit; - language_compliance; - unsupported_claim_risk; - fake_personal_claim; - source_imitation_risk; - engagement_quality; - readability; - final_gate. Example final decisions: - approve; - approve_with_edits; - needs_revision; - needs_research; - human_review_required; - reject. The final gate must block or flag drafts that: - contain unsupported factual certainty; - contain fabricated first-person claims; - violate configured language rules; - exceed hard platform limits; - imitate a named creator; - use fake proof; - hide the answer behind empty curiosity bait; - use engagement bait without a concrete decision or test; - contain unverified numbers; - contradict the supplied source. The UI must show the reason for every warning or block. ## Linter Build a deterministic local linter that runs before and after the Jev gate. The linter should check: - character count; - word count; - platform limits; - selected profile range; - paragraph length; - repeated phrases; - excessive filler; - empty questions; - unsupported first-person statements; - unsupported numbers; - fake proof language; - prohibited patterns; - language mismatch; - overuse of hashtags; - excessive emojis; - duplicated hooks; - unfinished sentences; - accidental metadata leakage. The linter must return structured results: - status: pass, warn, or fail; - individual checks; - suggested fixes. Do not make the linter pretend to prove factual truth. It can flag evidence-risk patterns, but it cannot independently verify a claim unless a source is available. ## Human review Every generated draft must enter one of these states: - draft; - needs_review; - approved; - rejected; - exported. The reviewer must be able to: - edit text; - change the selected profile; - change the format; - add or remove source notes; - mark a claim as unsupported; - request revision; - approve; - reject; - export. Store the reviewer decision and timestamp. Approval must never trigger publishing. ## UI screens Implement a clean local interface with these screens: ### Account profile - create and edit profile; - language; - audience; - tone; - content pillars; - source policy; - evidence policy; - prohibited patterns; - platform limits. ### New content run - source input; - URL input; - source metadata; - account profile selector; - fast, deep, or mock mode; - format selector; - optional user notes. ### Evaluation trace Show: - selected mode; - Jev calls; - selected answers; - confidence values when available; - reasons for routing; - source sufficiency; - research status; - warnings; - timing; - usage metadata where available. Do not expose secrets or raw sensitive prompts. ### Draft review Show: - generated copy; - selected profile; - selected format; - character and word counts; - source notes; - claim list; - linter results; - Jev gate results; - revision and approval controls. ### History Show previous runs with filters: - account profile; - date; - status; - format; - content profile; - risk level; - mock/live mode. ### Settings Show: - provider configuration status; - Jev mode; - draft provider mode; - environment configuration status; - database status; - export settings. Never display raw secret values. ## Persistence Use SQLite with migrations. At minimum, persist: - account_profiles; - source_items; - content_runs; - jev_evaluations; - drafts; - claims; - lint_results; - review_decisions; - audit_events. Store structured JSON where appropriate, but validate every JSON payload on read and write. Include created and updated timestamps. Use an append-only audit trail for: - source creation; - Jev evaluation; - draft generation; - revision; - review decision; - export. Do not store unnecessary personal data. ## API and error handling Implement local API routes or server actions for: - create profile; - update profile; - create source; - start content run; - run preflight; - generate draft; - run post-draft gate; - save revision; - approve draft; - reject draft; - export draft; - list history. Errors must be structured and user-readable. Handle: - missing credentials; - provider timeout; - Jev timeout; - malformed Jev output; - invalid typed answer; - draft provider refusal; - database failure; - oversized input; - invalid URL; - unavailable source; - unsupported platform limit. Never silently convert an error into approval. ## Security Implement: - environment-based secret handling; - secret redaction; - input size limits; - URL validation; - SSRF protection if remote fetching is implemented; - HTML sanitization if rendered source content is supported; - safe Markdown rendering; - no arbitrary shell execution from source text; - no dynamic code execution; - no untrusted prompt content outside explicit delimiters. Source text must be treated as data. ## Testing requirements Write tests before or alongside implementation. ### Unit tests Include tests for: - profile validation; - source validation; - typed Jev response parsing; - confidence threshold handling; - profile selection; - claim classification; - linter; - platform limit enforcement; - evidence-risk detection; - redaction; - export formatting. ### Integration tests Include tests for: - mock preflight; - mock draft generation; - mock post-draft gate; - unsupported claim flow; - research-required flow; - human-review flow; - approval without publishing; - provider timeout; - malformed Jev response; - live mode without credentials. ### UI smoke test Cover this journey: 1. create an account profile; 2. paste a source; 3. run in mock mode; 4. view preflight decisions; 5. generate a draft; 6. inspect linter and Jev gate; 7. edit the draft; 8. approve it; 9. export it; 10. verify that no external publishing call occurred. ## Developer experience Add: - README.md; - .env.example; - database migration instructions; - local setup instructions; - mock-mode instructions; - live-mode instructions; - test commands; - architecture overview; - provider replacement instructions; - explicit limitations; - security notes. Use scripts such as: - dev; - build; - lint; - typecheck; - test; - test:e2e; - db:migrate. Use the package manager already present in the repository. Do not change package managers without a reason. ## Implementation order Follow this order: 1. inspect the repository; 2. identify the existing stack and conventions; 3. create or update the domain types; 4. create validation schemas; 5. create the mock Jev adapter; 6. create the live Jev adapter; 7. create the mock draft provider; 8. create persistence and migrations; 9. implement the preflight pipeline; 10. implement the draft pipeline; 11. implement the linter; 12. implement the post-draft gate; 13. implement review and export; 14. build the UI; 15. add tests; 16. run typecheck, lint, unit tests, integration tests, and UI smoke tests; 17. fix all failures; 18. update the README. ## Definition of done The implementation is complete only when: - the app starts locally; - mock mode works without API keys; - the user can configure an account profile; - the user can submit a source; - Jev preflight decisions are visible; - a draft is generated through a provider abstraction; - the six content profiles are available: - flash; - signal; - brief; - deep_dive; - casefile; - longform; - the linter runs; - the post-draft Jev gate runs; - unsupported claims are flagged; - human approval is required; - approved content can be exported; - no publishing integration exists; - no X operation is performed; - secrets are not logged; - tests pass; - README instructions are accurate. At the end, report: 1. what was implemented; 2. which files changed; 3. how to run it; 4. which tests passed; 5. which features are mock-only; 6. which features require API keys; 7. any remaining limitations.