effect-ai-chat

effect-ai-chat is a skill for Claude Code, Codex from mpsuesser/pi-effect-harness. It costs 48 tokens per session (3,459 once invoked), scanned A, original, MIT.

A guide to Effect's Chat module for building conversations where an AI model remembers earlier messages and can stream replies or call tools.

In plain words
What is it for?
Use it to build multi-turn chats, agent tool-calling loops, persistent sessions, streaming replies, or structured objects generated during a conversation.
Why use it?
It provides a defined way to manage chat history, saved conversations, streaming output, and structured responses.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build multi-turn chats, agent tool-calling loops, persistent sessions, streaming replies, or structured objects generated during a conversation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mpsuesser/pi-effect-harness/effect-ai-chat
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mpsuesser/pi-effect-harness --skill effect-ai-chat
Clone the repo
git clone --depth 1 https://github.com/mpsuesser/pi-effect-harness

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for effect-ai-chat

README.md
[![agentmods](https://agentmods.dev/badge/skills/mpsuesser/pi-effect-harness/effect-ai-chat/github.svg)](https://agentmods.dev/skills/mpsuesser/pi-effect-harness/effect-ai-chat)
Your own site
<a href="https://agentmods.dev/skills/mpsuesser/pi-effect-harness/effect-ai-chat"><img src="https://agentmods.dev/badge/skills/mpsuesser/pi-effect-harness/effect-ai-chat/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for effect-ai-chat

Your own site · 80×15
<a href="https://agentmods.dev/skills/mpsuesser/pi-effect-harness/effect-ai-chat"><img src="https://agentmods.dev/badge/skills/mpsuesser/pi-effect-harness/effect-ai-chat.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,459 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.03459
Opus 5 $0.00024 $0.01729
Sonnet 5 $0.00010 $0.00692
Haiku 4.5 $0.00005 $0.00346

Measured 9d ago against content hash e47202d26c3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

effect-ai-chat scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

harnesses/effect/skills/effect-ai-chat/SKILL.md · 473 lines

How it starts

The opening of the file, as written. The whole thing — 473 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an Effect TypeScript expert specializing in the Chat module for stateful AI conversations.

Effect Source Reference

The Effect v4 source is available at ~/.cache/effect-v4/. Browse and read files there directly to look up APIs, types, and implementations.

Reference this for:

  • Chat module source: packages/effect/src/unstable/ai/Chat.ts
  • Chat usage examples: ai-docs/src/71_ai/30_chat.ts
  • Tool integration examples: ai-docs/src/71_ai/20_tools.ts
  • Prompt construction: packages/effect/src/unstable/ai/Prompt.ts

Core Imports

import { Effect, Layer, Ref, Schema, Context, Stream } from 'effect';
import {
	Chat,
	Prompt,
	LanguageModel,
	Tool,
	Toolkit,
	AiError
} from 'effect/unstable/ai';

What Chat Provides

The Chat module wraps LanguageModel with automatic conversation history management. Each Chat instance:

  • Maintains a Ref<Prompt.Prompt> of accumulated messages
  • Serializes calls via an internal semaphore (one generation at a time)
  • Automatically appends user prompts and model responses to history
  • Supports generateText, streamText, and generateObject
  • Provides export / exportJson for serialization and fromExport / fromJson for restoration

Creating Sessions

Empty session

const session = yield* Chat.empty;

With a system prompt

const session =
	yield*
	Chat.fromPrompt(
		Prompt.empty.pipe(Prompt.setSystem('You are a helpful assistant.'))
	);

From raw message array

const session =
	yield*
	Chat.fromPrompt([
		{ role: 'system', content: 'You are an assistant that can use tools.' },
		{ role: 'user', content: 'Hello!' }
	]);

From serialized JSON (restoring a session)

const session = yield* Chat.fromJson(savedJsonString);
// Or from structured data:
const session = yield* Chat.fromExport(savedData);

Generating Text (Single Turn)

Call session.generateText with a prompt. The prompt is concatenated with accumulated history, sent to the model, and the response is appended to history automatically.

Read the full file on GitHub · 473 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 473 lines · 48 tokens per session scan A e47202d26c3b

Subscribe to this mod's changes

effect-ai-chat is a skill published in the GitHub repository mpsuesser/pi-effect-harness (24 stars, last pushed 2mo ago), licensed MIT. It adds 48 tokens to every session and 3,459 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.