Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesClaude Code & Agentic DevelopmentAdvanced Patterns
Claude Code terminal: the claude -p command with Read and Edit allowedRetries after a 429 error: each pause is twice as long, then successText cut into overlapping chunks, the top three lifted into results
Get started free
Course

Claude Code & Agentic Development

Module 1 · Getting Started
01Installation and First Session02How Claude Code Reads a Codebase03An Effective CLAUDE.md
Module 2 · Daily Workflows
04Slash Commands and Custom Commands05Breaking Features into Tasks06Claude Code and git07Agentic Debugging
Module 3 · Power Features
08MCP Servers in Claude Code09IDE Integration10Advanced Patterns
Claude Code & Agentic Development · Lesson 10

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.

35 min readUpdated Nov 9, 20264 questions in quizReady prompt included

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.

Start free: 7 days of full access →
Lesson 10 of 10opens after free sign-up

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.

Course program →
🔒

Full lesson access

Advanced Patterns opens after free sign-up: 7 days of full access to every course, no card needed.

Start 7-day free trial
Then Pro: $9/mo or $79/yr

View plans →

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 guidesUse nowWhat 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 promptLimits 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
—--bareSkips hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md for the same result on every machine; needs ANTHROPIC_API_KEY
—--output-format jsonResult, session id and total_cost_usd for scripts; --json-schema for structured output
Sources: Claude Code docs, “Run Claude Code programmatically” and “Permission modes”.

Session lifecycle on a long project

  1. StartCLAUDE.md loads automatically; the agent reads git log
    →
  2. WorkPlan mode for big changes, /compact with a focus
    →
  3. CloseAppend decisions to CLAUDE.md, make a meaningful commit
    →
  4. Hand overList 3 “where to continue” points for the next session
    →
Each session starts with a fresh context window; CLAUDE.md, auto memory, git and --continue / --resume carry knowledge over.
In this lesson
Multi-session projectsNon-interactive mode (scripts and CI)Official CI integrationsBackground and parallel workClaude Agent SDKCost managementWhen Claude Code beats manual workPractical takeawayPracticeReady promptQuiz
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix

Cost facts from the Claude Code docs

Checked on 9 Nov 2026 (docs: Manage costs effectively).

  • Across enterprise deployments the average is about $13 per developer per active day and $150–250 per month; 90% of users stay under $30 per active day.
  • /clear between unrelated tasks starts fresh at no cost; /compact reads the whole conversation it summarizes, so on a large context it is itself a large request.
  • Keep CLAUDE.md under 200 lines: it loads into every session. Move workflow-specific instructions into skills, which load on demand.
  • /usage shows session tokens and, on Pro, Max, Ultra, Team and Enterprise, what consumes your plan limits. In scripts, --output-format json returns total_cost_usd.
  • Sonnet handles most coding tasks for less than Opus; keep Opus for complex architecture and multi-step reasoning.

Sources we checked

  • Claude Code docs: Run Claude Code programmatically
  • Claude Code docs: Manage costs effectively
  • Claude Code docs: Permission modes
  • Claude Code docs: GitHub Actions
  • Claude Code docs: Memory and CLAUDE.md

FAQ

How do I run Claude Code in CI?+

Call claude -p "task" with an explicit --allowedTools list or --permission-mode dontAsk, and add --bare so the run ignores local hooks, plugins and CLAUDE.md (set ANTHROPIC_API_KEY). The exit code is 0 on success. For GitHub, the docs describe a ready GitHub Actions integration.

How do I keep context between Claude Code sessions?+

Put durable rules, stack and decisions in CLAUDE.md, which loads at the start of every session, and make commits that explain why. To continue a specific conversation, use claude --continue or claude --resume <session-id>.

How can I reduce Claude Code costs?+

Use /clear when switching to unrelated work, /compact with a focus in long sessions, exact file paths in prompts, a short CLAUDE.md, Sonnet for routine tasks, and run CI jobs only on the events that need them.

Should I use /compact or /clear?+

/clear when the next task has nothing to do with the current one: it is free and resets the context. /compact when you need continuity; tell it what to keep, for example “/compact Focus on test output and code changes”.

When is manual work better than Claude Code?+

When the decision is architectural with implicit trade-offs and stakeholders, when it needs product or business judgment, or when a mistake is costly and no automatic tests can catch it. Routine refactors, migrations and test-driven debugging suit the agent.

Is this lesson free?+

It is lesson 10 of 10 in “Claude Code & Agentic Development”. A free account opens this lesson and the rest for 7 days with no card, and the first two lessons stay open after that. After that Pro costs $9 a month or $79 a year.

Related lessons and courses

Free lesson 1: install Claude Code →Writing an effective CLAUDE.md →MCP servers in Claude Code →Claude Code course →MCP tools and integrations →AI coding tools →

Open the lesson with a ready session-closing prompt

The full lesson covers multi-session projects, CI, cost control and where the agent beats manual work, with a practical task and a quiz. A free account opens all 10 lessons for 7 days.

Create a free account →