Prompt

Seshat does not treat the system prompt as one flat string glued together at random. The runtime builds a layered prompt with a stable core, a dynamic boundary, turn-specific runtime context, project instructions, memory, stage overlays, appended caller context, and provider-facing tool hints. This page documents that architecture and every important prompt-shaping parameter exposed to Go SDK developers.

Prompt Assembly Architecture

The prompt builder is intentionally layered so that stable identity and behavior rules remain cacheable while live session context stays dynamic. That is why Seshat can preserve a durable runtime contract without pretending the whole prompt is static across turns.

Stable Core
Default Seshat prompt sections

Identity, runtime contract, working rules, factual discipline, tool use, workflow, modes, orchestration, examples, and output discipline form the cacheable stable prefix.

Shipped prompt core
Boundary
Dynamic boundary marker

The builder inserts a structural marker between stable and dynamic prompt layers. It changes prompt assembly behavior but is never rendered into the final text sent to the provider.

Assembly-only protocol marker
Dynamic Runtime
Runtime context, project instructions, memory, and stage overlay

The builder injects live session metadata, tool surface, project instructions from the working directory, memory context, and any execution-stage overlay for the current turn.

Turn-specific runtime layer
Caller Layer
Append prompt and session overrides

Client-level and session-level overrides can replace the base persona or append durable and run-specific business context after the runtime-owned layers.

Host-controlled customization
Provider Layer
Provider-facing tool definitions with hints

Tool hints do not rewrite the main system prompt. They are appended to provider-facing tool descriptions so tool choice behavior can change without mutating tool code.

Prompt plus tool-definition shaping

The Pre-Existing Prompt Core

Before your application appends or overrides anything, Seshat already ships a substantial default prompt core. It covers identity, runtime contract, working rules, factual discipline, tool usage, workflow, orchestration, examples, and output discipline.

SectionPriorityLayerPurposeNotes
identity1000stableDefines the default Seshat role and baseline identity.Part of the cacheable stable prefix.
runtime_contract975stableDefines transcript correctness and recoverable runtime behavior.Stable core behavior contract.
working_rules950stableCovers read-before-write discipline and destructive-action caution.One of the main guardrail sections.
factual_discipline940stablePushes verification over unsupported claims.Important for high-risk or current facts.
tool_use900stableExplains how the model should use the runtime tool surface.Includes progress-tracking and ask-user guidance.
tool_priority899stableDefines preferred tool ordering and information-gathering chain.Includes MCP-vs-builtin preference rules.
workflow898stableDefines the default mono-run workflow order.Connects repo inspection, todo tracking, delegation, and completion rules.
modes897stableExplains plan mode and sub-agent usage.Part of the built-in orchestration behavior.
orchestration895stableGives deeper rules for delegation and sub-agent prompt writing.Extends the multi-agent discipline.
workflow_examples890stableProvides example execution patterns for direct work, planning, and delegation.Stable example section in the shipped prompt.
verification_examples888stableShows when local evidence is enough versus when verification is required.Strengthens the factual-discipline contract.
output_discipline875stableConstrain final output style toward concise implementation-oriented responses.Last stable section before the dynamic boundary.
dynamic_boundary850dynamic markerSeparates cacheable stable prompt text from turn-specific dynamic content.Structural marker only; it is not rendered into the provider-facing prompt text.
runtime_context800dynamicInjects session id, turn number, working directory, model, provider, and visible tools.Changes every turn and is never part of the stable cacheable prefix.
runtime_guidance780dynamicExplains how to interpret the live runtime context and tool surface.Built dynamically by the prompt builder.
project_instructions775dynamicInjects project-level instructions discovered from the working directory.Checks SESHAT.md, AGENTS.md, then .seshat/instructions.md, capped at 32 KB.
stage_overlay770dynamicAdds stage-specific instructions such as plan mode or continuation.Can be replaced with StageOverrides.
runtime_memory760dynamicInjects memory context when the runtime memory system is active.Absent when memory is disabled or no context exists.
append_system_promptafter assemblydynamic appendAdds caller-supplied appended instructions after all runtime-built sections.Comes from PromptConfig.AppendSystemPrompt or Session.SetAppendSystemPrompt.

Prompt Parameters And Overrides

These are the practical Go SDK surfaces that shape the prompt. The table deliberately mixes client-level config with session methods because both matter when you design embedded agent behavior.

API surfaceScopePurposeRuntime effectNotes
ClientConfig.SystemPromptTemplateclientProvides a base system prompt template for the client.Replaces the default Seshat stable identity while keeping runtime-owned dynamic context.Best when you want one durable persona per client.
PromptConfig.SystemPromptclientPerforms the strongest prompt override.Replaces the core stable prompt contract and skips the normal stable core sections.Use deliberately; you now own more of the behavior contract yourself.
PromptConfig.AppendSystemPromptclientAppends stable business or product context after runtime-built sections.Adds domain context every turn without replacing the base persona.Often the safest customization path.
PromptConfig.StageclientPins the prompt into a specific execution-stage overlay.Injects the selected stage behavior into the dynamic prompt section.Useful for forcing plan mode from the host side.
PromptConfig.StageOverridesclientReplaces built-in overlay text for one or more stages.Lets the host keep runtime stages but rewrite their instructions.Good for custom planning or continuation discipline.
PromptConfig.ToolHintsclientAdds extra guidance to chosen provider-facing tool descriptions.Changes tool selection behavior without editing tool definitions.Hints are applied per canonical tool name.
Session.SetSystemPromptTemplatesessionOverrides the client-level base prompt for one run.Creates a session-specific persona while keeping the same runtime stack.Empty string clears the override.
Session.SetAppendSystemPromptsessionAdds run-specific appended context.Useful for one release window, tenant context, or assignment-specific rules.Empty string clears the override.
Session.SetWorkingDirectorysessionChanges the working directory used in runtime prompt context.Also changes where project instructions are discovered from.Project instructions lookup checks SESHAT.md, AGENTS.md, and .seshat/instructions.md in that root.
PromptFnclientBridges runtime-to-user prompts such as approvals or questions.Does not customize the system prompt itself.Important to document because developers often confuse it with prompt shaping.

Structured Prompt Customization

In most products, PromptConfig is the right first tool. It is strong enough to add durable business context, tool-use bias, and custom stage overlays without forcing a full replacement of the shipped runtime contract.

PromptConfig
func ptr(value string) *string { return &value }

client, err := sdk.NewClient(&sdk.ClientConfig{
    Model: sdk.ModelIdentifier{
        Provider: sdk.APIProviderAnthropic,
        Model:    "claude-sonnet-4-20250514",
    },
    APIKey: os.Getenv("ANTHROPIC_API_KEY"),
    PromptConfig: &sdk.PromptConfig{
        AppendSystemPrompt: ptr(`Business context:
- Reliability beats speed.
- Migrations must be backward compatible.`),
        ToolHints: map[string]string{
            "bash":        "Prefer inspection commands before mutating commands.",
            "apply_patch": "Keep edits minimal and reviewable.",
        },
        StageOverrides: map[sdk.ExecutionStage]string{
            sdk.StagePlan: `# Stage: plan mode

Tool execution is suspended.
- Produce a concise numbered plan.
- Mention risks and validation steps.
- Do not execute tools.`,
        },
    },
})

Full Override Versus Safe Extension

A full override exists because some host applications genuinely need it, but it should not be your default instinct. Extending the prompt is usually safer than replacing the whole stable contract.

Full override
func ptr(value string) *string { return &value }

client, err := sdk.NewClient(&sdk.ClientConfig{
    Model: sdk.ModelIdentifier{
        Provider: sdk.APIProviderAnthropic,
        Model:    "claude-sonnet-4-20250514",
    },
    APIKey: os.Getenv("ANTHROPIC_API_KEY"),
    PromptConfig: &sdk.PromptConfig{
        SystemPrompt: ptr(`You are the internal release-audit runtime.

Rules:
- Be conservative.
- Audit for regressions and rollback risk.
- Return blockers before suggestions.`),
    },
})
1Append first

Use AppendSystemPrompt when you only need extra business or domain context.

2Hint tools second

Use ToolHints when the issue is tool-choice behavior rather than the full persona.

3Override last

Use SystemPrompt only when you intentionally want to own more of the core behavior contract.

Session-Level Prompt Context

Session overrides are the right layer for context that should not affect every future run. Release windows, tenant details, one-off compliance instructions, or temporary operational context belong here.

Session append
session, err := client.CreateSession(ctx)
if err != nil {
    log.Fatal(err)
}
defer session.Close()

session.SetAppendSystemPrompt(`Release context:
- branch: release/2026.06
- freeze: active
- production incidents: 0 open`)

_, err = session.SubmitMessage(ctx, "Inspect the auth service for release blockers.")

Execution Stages

Stages are not generic labels. They are real overlays injected into the dynamic prompt layer. You can let the loop infer them when appropriate, or you can pin the stage explicitly from the host side.

Pinned stage
client, err := sdk.NewClient(&sdk.ClientConfig{
    Model: sdk.ModelIdentifier{
        Provider: sdk.APIProviderAnthropic,
        Model:    "claude-sonnet-4-20250514",
    },
    APIKey: os.Getenv("ANTHROPIC_API_KEY"),
    PromptConfig: &sdk.PromptConfig{
        Stage: sdk.StagePlan,
    },
})
Stage constantValueTypical useEffect
StageDefault""Normal operation with no forced overlay.No extra stage section is injected unless the loop auto-detects a stage such as tool-result handling.
StageToolCalltool_callManual loop wiring when the model is expected to dispatch tools.Adds guidance telling the model to proceed with necessary tool calls without duplication.
StageToolResulttool_resultManual or advanced loop control when tool results are being reintegrated.Tells the model to integrate results into a direct useful response.
StageContinuationcontinuationResume an unfinished response cleanly.Adds a continuation nudge that tells the model to resume directly instead of recapping.
StagePlanplanHost-enforced planning mode or custom plan-mode products.Suspends tool execution expectations and asks for a numbered plan instead.

Project Instructions And Working Directory

The prompt builder also pulls project-level instructions from the active working directory. It checks SESHAT.md, then AGENTS.md, then .seshat/instructions.md, taking the first non-empty file and truncating at 32 KB if needed. This is why working-directory control is part of prompt architecture, not just file-tool setup.

What To Use When

  1. Use SystemPromptTemplate for a durable client-level persona.
  2. Use AppendSystemPrompt for stable domain or business context.
  3. Use ToolHints to nudge tool behavior without rewriting the persona.
  4. Use StageOverrides when the built-in plan or continuation wording is not right for your product.
  5. Use session overrides for one run, one tenant, one release, or one mission.
  6. Use a full override only when you intentionally want to replace the shipped stable contract.

Related Pages

Continue with Agent for persona and role patterns, Tools & Surface for the action layer, or Mono-Run Architecture for the runtime-side view behind this prompt assembly.