sap-session-next-turn

A command for advancing an SAP troubleshooting session through its evidence-based stages. SAP is business software used to manage processes such as finance, sales, and supply chains.

In plain words
What is it for?
Running hypothesis and verification turns, processing newly supplied evidence, handling resolved or escalated cases, and reopening investigations when needed.
Why use it?
It chooses the next valid investigation step from the saved session state, reducing manual tracking and preventing unsupported jumps.

Command

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.

agentmods
npx agentmods add commands/boxlogodev/sapstack/sap-session-next-turn
Clone the repo
git clone --depth 1 https://github.com/BoxLogoDev/sapstack
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,294 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00054 $0.02294
Opus 5 $0.00027 $0.01147
Sonnet 5 $0.00011 $0.00459
Haiku 4.5 $0.00005 $0.00229

Measured 2d ago against content hash 48aed5f244e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sap-session-next-turn 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 2d 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.

commands/sap-session-next-turn.md · 223 lines

How it starts

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

/sap-session-next-turn — 다음 AI 턴 실행

입력: $ARGUMENTS

Evidence Loop의 엔진입니다. 세션 상태를 읽고 다음에 실행해야 할 정당한 턴 을 자동으로 결정해 수행합니다. 운영자는 "다음 진행"만 요청하면 되고, AI가 Turn 2/4 구분과 출력 포맷 선택을 책임집니다.

🧭 턴 결정 로직

load state.yaml
switch state.status:
  case intake:
    → Turn 1 마무리 & Turn 2 시작 (Hypothesis)
  case hypothesizing:
    → Turn 2 (Hypothesis) 재실행 불가 — 이미 진행 중
    → 상태 이상이므로 운영자에게 알림
  case awaiting_evidence:
    → 새 Bundle이 없으면 거부
    → Bundle이 있으면 Turn 3 자동 처리 후 Turn 4 (Verify)
  case verifying:
    → Turn 4 (Verify) 실행
  case resolved:
    → 이미 완료 — reopen 권유
  case escalated:
    → 인계된 전문가에게 맡길 것을 상기
  case abandoned:
    → 재개할 수 없음. 새 세션 권유.
  case reopened:
    → Turn 2 재진입 (새 증거 바탕으로)

--force-hypothesize--force-verify디버그용입니다. 일반 운영에서 사용하지 마세요. 무결성이 깨질 수 있습니다.

🎛 Turn 2 (Hypothesis) 실행 상세

2-1. 증거 종합

  • state.bundles[] 전부 로드
  • 모든 items[]를 종류별로 그룹화
  • 각 아이템의 source, tags, interpretation 힌트 수집

2-2. symptom-index 힌트 적용 (있으면)

  • state.initial_symptom.matched_symptom_index_entry가 있으면 해당 엔트리의 first_check_tcodes, typical_causes, localized_checks를 가설 생성의 시드로 사용

2-3. 가설 생성 (2-4개)

plugins/sap-session/skills/sap-session/references/turn-formats.md의 Turn 2 섹션 규칙을 정확히 따름:

  • 각 가설에 falsification_evidence 최소 2개 (필수)
  • confidence 분포 다양화 (전부 0.8+ 금지)
  • 최고 confidence 0.95 상한
  • 최소 1개는 "컨트롤 가설" (재시도로 해결 같은 단순 경로)
  • consultant_agents_to_involve 필수 지정

2-4. 컨설턴트 에이전트 소환 (선택적 — 이 단계에서도 가능)

가설 생성 단계에서 이미 관련 모듈의 컨설턴트를 호출하면 가설 품질이 올라갑니다. 단, 호출은 병렬로, 각 에이전트에게 현재 Bundle을 요약해서 전달.

병렬 호출 파이프라인:

for agent in hypothesis.consultant_agents_to_involve:
    spawn Agent(subagent=agent, context={bundles, symptom, country})
await all

소환 결과는 가설의 technical_chain을 풍부하게 하는 데 사용. 이 단계에서 에이전트가 "이 가설은 말이 안 된다"고 반론하면 가설 confidence 하향.

2-5. Follow-up Request 생성

plugins/sap-session/skills/sap-session/references/followup-authoring.md의 5가지 품질 기준(최소성·반증 중심성·비용 정직성·안전성·명확성)을 모두 준수.

2-6. 상태 전이

  • hypotheses/h-*.yaml에 각 가설 저장
  • requests/flr-*.yaml에 Follow-up Request 저장
  • state.hypotheses[], state.followup_requests[]에 append
  • turns[]에 Turn 2 엔트리 (complete) + Turn 3 엔트리 (pending)
  • status: intake → awaiting_evidence (Turn 2+3를 한 번에 셋업)
  • audit_trail: hypothesis_proposed, followup_requested
  • current_turn_number: 3

Read the full file on GitHub · 223 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. 2d ago First seen · 223 lines · 54 tokens per session scan A 48aed5f244e1

Subscribe to this mod's changes

sap-session-next-turn is a command published in the GitHub repository BoxLogoDev/sapstack (18 stars, last pushed 3d ago), licensed MIT. It adds 54 tokens to every session and 2,294 once invoked, about $0.0003 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.