Claude Code Advanced Patterns: Multi-Session Projects, CI and Costs
Multi-session projects (CLAUDE.md, auto memory, git), Claude Code in scripts and CI (`-p`, `--bare`, permissions, GitHub Actions), background, cloud and scheduled tasks, the Agent SDK, cost control, and the line between agent and manual work.
What are the advanced patterns for working with Claude Code?
Carry context between sessions in CLAUDE.md and meaningful git commits; run one-off jobs in scripts and CI with claude -p and a narrow --allowedTools list; control cost with /clear between tasks, focused /compact and a CLAUDE.md under 200 lines; give the agent routine, testable work and keep architecture decisions with people.
Claude Code & Agentic Development
The final lesson of a 10-lesson course for developers: setup, codebase navigation, CLAUDE.md, slash commands, task breakdown, git, debugging, MCP and IDE integration. The first two lessons are open.
One trial lesson is open without sign-up: what a large language model is →
CI flags: old guides vs current Claude Code
Older guides use flags that never existed in the CLI. Use these instead (Claude Code docs, 9 Nov 2026).
| In old guides | Use now | What it does |
|---|---|---|
| --no-interactive | -p (--print) | Runs one prompt and prints the result; in Manual mode, calls that need approval are denied unless allowed |
| --include / --exclude | --allowedTools "Read,Edit,Bash(git diff *)" and exact paths in the prompt | Limits what the agent may do without asking; --add-dir adds a directory |
| --permission-mode plan in CI | --permission-mode dontAsk (or acceptEdits for edit jobs) | dontAsk denies anything that would prompt: meant for locked-down CI |
| — | --bare | Skips hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md for the same result on every machine; needs ANTHROPIC_API_KEY |
| — | --output-format json | Result, session id and total_cost_usd for scripts; --json-schema for structured output |
Session lifecycle on a long project
- StartCLAUDE.md loads automatically; the agent reads git log
- WorkPlan mode for big changes, /compact with a focus
- CloseAppend decisions to CLAUDE.md, make a meaningful commit
- Hand overList 3 “where to continue” points for the next session


