Class PlanModeManager
State (whether plan mode is active and which markdown file holds the current plan) lives in
PlanModeContextState inside the agent's AgentState, so it is persisted with the
session and survives restarts / cross-node hand-offs — this is the mechanism that makes dynamic
(runtime) plan-mode switching work in a distributed setting, where an in-process boolean would be
lost.
The plan markdown file is written exclusively through WorkspaceManager, never via
java.nio.file.Files, so it lands on whatever backend (local, sandbox, remote) the agent's
filesystem is configured with. The logical path stays <planDir>/PLAN.md for every
isolation scope; per-scope isolation is applied transparently by the filesystem (store namespace
for remote, snapshot key for sandbox) rather than by encoding it into the path.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault workspace-relative directory for plan files. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenter(io.agentscope.core.state.AgentState state) Enters plan mode.voidexit(io.agentscope.core.state.AgentState state) Exits plan mode (back to BUILD).booleanisPlanActive(io.agentscope.core.state.AgentState state) planFilePath(io.agentscope.core.state.AgentState state) Workspace-relative path of the plan file currently associated with this agent.writePlan(io.agentscope.core.agent.RuntimeContext rc, io.agentscope.core.state.AgentState state, String content) Writes (creates or overwrites) the plan markdown file through the workspace filesystem and records its path in state.
-
Field Details
-
DEFAULT_PLAN_DIR
Default workspace-relative directory for plan files.- See Also:
-
-
Constructor Details
-
PlanModeManager
-
-
Method Details
-
isPlanActive
public boolean isPlanActive(io.agentscope.core.state.AgentState state) -
enter
Enters plan mode. Idempotent. Ensures a plan file path is recorded (default if none set).- Returns:
- the workspace-relative plan file path
-
exit
public void exit(io.agentscope.core.state.AgentState state) Exits plan mode (back to BUILD). Idempotent. KeepscurrentPlanFilefor reference. -
planFilePath
Workspace-relative path of the plan file currently associated with this agent. -
writePlan
public String writePlan(io.agentscope.core.agent.RuntimeContext rc, io.agentscope.core.state.AgentState state, String content) Writes (creates or overwrites) the plan markdown file through the workspace filesystem and records its path in state.- Returns:
- the workspace-relative path written
-