Skip to main content
The code command starts a code assistant session optimized for programming tasks.
praisonai code is safe by default: file writes and shell commands prompt for approval on first call. Pass --no-safe or --dangerously-skip-approval to restore the legacy ungated behaviour. See Tool Approval.

Usage

praisonai code [OPTIONS] [PROMPT]

Arguments

ArgumentDescription
PROMPTCode-related prompt or question

Options

OptionShortDescriptionDefault
--model-mLLM model to usegpt-4o-mini
--verbose-vVerbose outputfalse
--tools-tComma-separated tool names (e.g. web_search,github) or a tools.py file path
--workspace-wWorkspace directory
--file-fAttach file(s) to context
--no-acpDisable ACP tools (file operations)false
--no-lspDisable LSP tools (code intelligence)false
--safe / --no-safeSafe mode: prompt before file writes and shell commands (default: on). Use --no-safe to disable.true
--dangerously-skip-approvalSkip all tool approval prompts and export PRAISONAI_TOOL_SAFETY=off for the subprocess treefalse
--session-sSession ID to resume
--continue-cContinue last sessionfalse
--no-contextDisable AGENTS.md/CLAUDE.md auto-loading into system promptfalse
--agent-aNamed custom agent profile from .praisonai/agents/ (tools + permission scope)
--thinkingReasoning effort for this invocation: off, minimal, low, medium, high
--checkpoints / --no-checkpointsAuto-checkpoint the workspace before each file-mutating turn, enabling in-session /undo and /revert--no-checkpoints
--revert <ref>One-shot: restore workspace to a prior checkpoint (id, short id, or last) and exit
Safe mode (--safe) is on by default as of PR #2369. Dangerous built-in tools ask for approval in interactive sessions and are denied in non-interactive (CI) sessions. Use --no-safe to opt out, or --dangerously-skip-approval for a complete bypass. See Approval for full details.

Piped Input

praisonai code reads piped stdin when the prompt is provided in the shell pipeline.
cat data.json | praisonai code "Write a parser for this shape"
Prompt argument is merged first, piped body second (joined with \n). See Piped Input.

Examples

Start code assistant

praisonai code

Ask a coding question

praisonai code "Write a Python function to sort a list"

Specify language context

praisonai code --language python "Explain decorators"

Disable safe mode (opt out of approval prompts)

praisonai code --no-safe "Refactor main.py"

Full bypass (no approval prompts, applies to subprocess tree)

praisonai code --dangerously-skip-approval "Clean up old logs"

Reasoning effort (per invocation)

praisonai code --thinking high "Refactor src/utils.py for readability"

Custom agent profile

# Profile defined in .praisonai/agents/plan.md
praisonai code --agent plan "Review the auth module and propose a refactor"

# Profile + reasoning effort combined
praisonai code --agent reviewer --thinking high "Audit src/security/"
See Custom Agents & Commands for profile definitions and Thinking for budget levels.

Project context

By default, praisonai code walks up from the current directory to your git root and prepends any AGENTS.md / CLAUDE.md / agents.md / .agents/AGENTS.md it finds to the agent’s system prompt, layered on top of ~/.praisonai/AGENTS.md. Pass --no-context (or set PRAISON_NO_CONTEXT=true) to disable. See Context Files for details.

Windows Automation

For Windows automation scenarios, use the --no-acp flag and set UTF-8 encoding:
# Windows PowerShell
$env:PRAISON_APPROVAL_MODE = "auto"
$env:PYTHONIOENCODING       = "utf-8"

praisonai code -w . --no-acp "Fix the failing tests"
See the Windows Automation section in Real-world Examples for complete setup instructions.

Auto checkpointing & in-session undo

Workspace checkpointing is off by default. Enable it with --checkpoints to auto-snapshot before each file-mutating turn, unlocking /undo and /revert inside the coding REPL.
praisonai code --checkpoints "Refactor auth module"

How /undo differs by mode

ModeWhat /undo does
Checkpointing off (default)Removes the last assistant+user message from history only
Checkpointing on (--checkpoints or checkpoints.auto: true)Removes the last turn from history and restores workspace files to the pre-turn checkpoint (diff preview first)

Interactive slash commands

Type these inside a praisonai code REPL when --checkpoints is active:
CommandWhat it does
/undoUndo the last turn: remove from history and restore workspace files
/revertSame as /revert 1 — roll back 1 turn
/revert 2Roll the workspace back 2 turns
Both commands show a diff preview before restoring and refuse to run while a turn is still in progress.

One-shot revert from CLI

praisonai code --revert last
Shows the diff preview and restores the workspace, then exits.

Project config

Enable checkpointing for all praisonai code sessions in a project:
# agents.yaml
checkpoints:
  auto: true
  storage_dir: ./.praisonai/checkpoints   # optional — shared with praisonai run
Precedence: PRAISONAI_CHECKPOINTS=on (env) > checkpoints.auto (config) > default (off). See Checkpoints for the full checkpoint feature reference.

See Also