12 Hidden Settings To Enable In Your Claude Code Setup

AAI LABS
Computing/SoftwareTelecommutingInternet Technology

Transcript

00:00:00Claude Code has so many features at this point that it's genuinely hard to keep up.
00:00:04Even with everything visible in the command menu, there is a lot that is not immediately
00:00:08apparent.
00:00:09Most of the problems you run into while using Claude Code actually have fixes already built
00:00:13in.
00:00:14They are just buried in config files and environment variables that hardly anyone talks about.
00:00:18We went through all of it and put together a list of hidden settings and flags you should
00:00:22enable right now.
00:00:23For the issues that Claude does not have a built in fix for, we also found some solid
00:00:27open source solutions.
00:00:28Now if you've ever run the insights command or used Claude with the resume flag, you might
00:00:32have noticed that all the conversations that show up are limited to just one month, even
00:00:37if you've been using Claude for much longer.
00:00:39And if you actually need to go back to those sessions or want an insight analysis for a
00:00:42longer period, now that opus 4.6 supports a 1 million token context window, you won't be
00:00:48able to do that because Claude Code doesn't store them on the system for longer than a
00:00:52month.
00:00:53Now this one month is the default time span set in Claude's configs for retained data,
00:00:57but that doesn't mean you can't modify these settings to retain data for longer.
00:01:01Claude actually has a setting for that.
00:01:02In the main.claud folder, there is a settings.json file.
00:01:06We'll be using this file for a lot of other settings throughout the video as well.
00:01:09This is how you change a lot of the default settings in Claude Code.
00:01:12You can add this cleanup period days field with any number of days you want.
00:01:16So if you set that to 365, it will be able to retain a full year's worth of conversations.
00:01:22And by setting it to zero, you're asking it to store none of your conversations, meaning
00:01:26you won't be able to extract any information or view past references.
00:01:30Another thing you can do is inside your .claud folder of your project, you can configure path
00:01:35specific rules.
00:01:36They are loaded into the context when the agent tries to modify a specific file.
00:01:40These rules are triggered on read operations and are loaded when the path pattern matches
00:01:44the file being read.
00:01:45They contain all of the instructions that need to be followed when working with that file.
00:01:49Normally, this is what people add in the main.claud.md.
00:01:52They dump all of the instructions related to different aspects of the app into one place.
00:01:57Although we don't need to worry about context now, it still helps with separation of concerns
00:02:01once your app gets too big.
00:02:03Putting them all in one place sometimes leads to Claude ignoring instructions you wrote because
00:02:07the file has become so large and full of instructions that Claude doesn't know which ones to actually
00:02:11focus on.
00:02:12For example, if it's working on the front end, it only needs to load the React component's
00:02:17instructions, not all of them at the same time.
00:02:19This keeps the agent more focused.
00:02:21As you already know, Claude code can run bash commands and read their outputs.
00:02:25But depending on the command, those outputs can be massive.
00:02:28Anthropic has set a limit on how many characters Claude can actually read from any command's
00:02:33output, and that limit is 30,000 characters.
00:02:35Anything beyond that gets truncated, and Claude never sees it.
00:02:38So for example, if you run your test suite and it prints thousands of lines of results,
00:02:42Claude is only going to read the set 30,000 characters of that output.
00:02:46Same thing if you're looking at build logs or running database migrations.
00:02:50Any command that dumps a lot into the terminal, Claude only gets the 30,000 characters.
00:02:54To fix this, in your settings.json, there is again a config that controls how many characters
00:02:59Claude code loads from the terminal into its context window.
00:03:03This was set to 30k because of the older 200k context window models where you couldn't afford
00:03:08to load more.
00:03:09But again, with the new 1 million token window, that's not a problem anymore.
00:03:13You can increase this to something like 150,000 so that the full output is actually loaded
00:03:18and Claude can read through all of it properly.
00:03:20If you are working on a project that contains a lot of sub-agents, each tailored towards
00:03:24working on their respective tasks, if we have a task specific for any agent, we normally
00:03:29ask Claude explicitly in our prompt to use that agent to do the task.
00:03:33But if you want to quickly hand the work to a specific agent, what you can do is run Claude
00:03:37as a sub-agent.
00:03:38You just need to use the agent flag and type in the name of the sub-agent you want to run
00:03:42Claude as.
00:03:43Now you can delegate tasks to it directly and use its capabilities and tools without the
00:03:47overhead of Claude first loading that sub-agent and then performing the task.
00:03:51As you might already know, you can set the model and MCP tools configuration when configuring
00:03:57sub-agents, but there are many more configurations you can add to a sub-agent.
00:04:00For example, sub-agents do not inherit skills by default, but if you use the skill flag,
00:04:04you can make that agent inherit a skill you've created for that specific sub-agent.
00:04:08This means it can actually use that skill to perform its tasks.
00:04:11Aside from skills, there's another flag called effort.
00:04:14If you didn't know, effort determines how much token and thinking power the agent uses
00:04:18when performing tasks.
00:04:19Some agents by default don't need much effort so you change it based on the task.
00:04:23In addition to effort, you can also configure hooks inside the sub-agent that are specific
00:04:28to that agent's workflow.
00:04:29You can also set whether an agent should always run in the background using the background
00:04:33flag.
00:04:34Set it to true if you want the agent to work completely in the background without disrupting
00:04:38the main agent or false if you want the agent to always appear at the top.
00:04:42You can also have sub-agents run in isolation in a separate work tree by setting the isolation
00:04:47config in the agent description.
00:04:49Isolated agents get a temporary copy of the work tree, giving them space to make significant
00:04:53changes without risking the main code base.
00:04:55If the agent makes no changes, the work tree chains up automatically.
00:04:59If there are changes, the work tree path and branch are returned for merging and review.
00:05:03This setup is best for experimenting with approaches that might break the main code base.
00:05:08Finally, you can control which agents a given agent is allowed to spawn by adding the permitted
00:05:12agent names in the tools section of that agent's config.
00:05:16This restricts spawning so that multiple agents aren't created unnecessarily, preventing
00:05:20a single agent from going rogue and continuously spinning up too many others.
00:05:24By default, when Claude reads from a file, it only reads 25k tokens.
00:05:28But ever since the context window increased to 1 million tokens, 25k is actually too small
00:05:34and doesn't let Claude utilize its full potential.
00:05:36You can change this in the settings.json by setting this flag to 100k or more.
00:05:41But there's another catch.
00:05:42No matter how large the context window is, Claude only reads 2000 lines, and it doesn't
00:05:47even know that it has missed the other lines, so it never goes back to read the rest.
00:05:51Anthropic doesn't allow you to change this limit.
00:05:53But there's a workaround.
00:05:54You can add an instruction in the Claude.md file so that whenever Claude reads large files,
00:05:59it first checks the line count.
00:06:01If the file exceeds 2000 lines, it uses offset and limit parameters to read the whole file
00:06:06properly, without missing anything in between.
00:06:08We can also configure a hook that is triggered whenever the read command runs.
00:06:12This hook checks the file's line count, and if it exceeds 2000 lines, it forces the agent
00:06:16to follow the instruction in Claude.md, using commands like HEAD to ensure Claude reads through
00:06:21to the end.
00:06:22As you already know, Claude code automatically triggers compact when the context window reaches
00:06:2795%.
00:06:28Even with the 1 million token context window, the agent doesn't actually need to wait until
00:06:32the context window is 95% full.
00:06:35The quality of output usually starts degrading when the context window fills up to 70%.
00:06:40This is the right time to trigger auto-compacting unless you need the full 1 million context
00:06:44window.
00:06:45To change this, you just need to add a config flag in the settings.json and set the auto-compact
00:06:50percentage override to whichever percent you like.
00:06:53We've set ours at 75%.
00:06:55Once this is in place, when your context window reaches 75%, it will automatically compact,
00:07:00maintaining the quality of the agent's output.
00:07:02But before we move on to the next features, let's have a word by our sponsor, Make.com.
00:07:06We all know the biggest risk with AI is the black box.
00:07:09You deploy agents, but you can't verify their decisions.
00:07:12Makes new agents completely change that.
00:07:14Its visual platform combines no code and AI to deploy agents that run your business.
00:07:19You can build intelligent agents directly inside their visual canvas.
00:07:22Just give your agent a goal, and with over 3000 native app integrations, it handles the
00:07:27complex decision-making for you.
00:07:29Beyond agents, the platform is packed with features.
00:07:31You get pre-built templates to start fast, MCP for secure connections, and the knowledge
00:07:36feature to ground responses.
00:07:38The reasoning panel lets you actually see, control, and trust every step the AI takes.
00:07:42Plus, with the Make grid, your monitoring and insights are in one centralized map.
00:07:46Stop doing manual busywork and create efficient workflows that save time and simplify scaling.
00:07:52Click the link in the pinned comment to grab your exclusive 1 month free Pro plan and try
00:07:56Make today.
00:07:57Now, most of you might already know this, but Agent Teams is still experimental, which is
00:08:01why many people don't know about it.
00:08:03In Agent Teams, there's one team leader and multiple team members, each being their own
00:08:07Claude Sessions, that are started and controlled by the team leader.
00:08:10The team leader is responsible for coordinating the whole task across all these team members.
00:08:15This is actually different from sub-agents, because sub-agents aren't able to communicate
00:08:19with each other.
00:08:20Whereas, in an agent team, each team member is able to communicate with one another and
00:08:24share information.
00:08:25We've actually created a full video on this, where we talk about its features and how to
00:08:29best use it in order to make the most out of its capabilities.
00:08:32Also, if you are enjoying our content, consider pressing the hype button, because it helps
00:08:36us create more content like this and reach out to more people.
00:08:40If you're managing multiple configurations for different types of work, there's an open
00:08:44source tool called Claude CTX that lets you quickly switch between configured profiles,
00:08:49manage client configurations separately, and handle permissions and tools across the same
00:08:54space providers.
00:08:55To install it, commands are listed for all operating systems.
00:08:58On Mac, you can use the brew install command, and on other systems, you can install it by
00:09:02cloning the repo.
00:09:03The tool manages your settings.json, claud.md, mcp servers, and backups by keeping track of
00:09:08profiles via a profiles folder inside the main.claud folder.
00:09:12This profiles folder contains a subfolder for each profile, with its own settings.json and
00:09:17claud.md each optimized for that particular profile.
00:09:21Each settings file contains only the permissions needed for that profile, so nothing bleeds
00:09:26across into another.
00:09:27Switching profiles is straightforward.
00:09:29You can check your current profile using this C flag, and to switch you run claud ctx, followed
00:09:34by the profile name you want.
00:09:35When you switch, it creates a backup of the current working state and saves it to the backup
00:09:39folder so you always have a record of the previous profile.
00:09:42This way you can keep multiple profiles completely separate and have claud work with exactly the
00:09:47permissions it needs without worrying about them merging with each other.
00:09:50Resources from all our previous videos are available in AI Labs Pro.
00:09:54Plates, skills, and a bunch of other stuff you can just plug straight into your projects.
00:09:58If you've found value in what we do and want to support the channel, this is the best way
00:10:02to do it.
00:10:03The link is in the description.
00:10:04If you get annoyed when claud co-authors itself on github commits, there's actually a workaround
00:10:09for that as well.
00:10:10In your settings.json, add the attribution key and leave the commit and PR fields empty.
00:10:15After that, whenever you ask claud to push to github, it won't co-author itself.
00:10:18You can also set it to a custom string so the commit shows whatever author name you choose.
00:10:23By default, claud code adds itself as a co-author to every commit, which means it shows up in
00:10:28your repository's contributor graph.
00:10:30Claud code also sends analytics data to statseg, where it tracks usage patterns and operational
00:10:35data like latency and reliability.
00:10:37This data is used to A/B test features and drive analytics.
00:10:41It also sends data to sentry for error logging, allowing anthropic to diagnose crashes and
00:10:45bugs in production.
00:10:47But if you want to opt out, you can do that by adding three variables to the main settings.json.
00:10:52These disable telemetry, error reporting, and feedback display.
00:10:55With these in place, claud code will no longer send your data out, keeping it private instead.
00:10:59But there is also a separate CLI flag in claud code to disable non-essential traffic, which
00:11:04might look like it does the same thing.
00:11:06The difference is that this flag also blocks auto-updates, which you probably don't want.
00:11:11So it's better to rely on the three settings instead, since they give you the same privacy
00:11:15benefit without cutting off updates.
00:11:17A lot of people also don't know about prompt stashing in claud code.
00:11:20If you're typing a prompt and realize you need to send claud code a different task first,
00:11:24you can press Ctrl + S to stash your current prompt.
00:11:28After that, you can type in and send the new one, and your stashed prompt automatically
00:11:31comes back into the input box.
00:11:33A lot of you might already be using hooks, but you can also use exit codes inside your
00:11:37hooks that tell claud whether the execution should proceed, be blocked, or be ignored.
00:11:41There are three primary types of exit codes.
00:11:44Exit code 0 means that the run was successful, and it indicates that the task assigned was
00:11:48done correctly.
00:11:49Most of the time, its outputs are not inserted into the context and serve just as an indicator
00:11:54that this was done correctly.
00:11:55Any other exit code, other than 0 and 2, is shown in verbose mode and is non-blocking,
00:12:01meaning that they are error messages, but claud does not consider them serious enough to stop
00:12:05its workflow.
00:12:06But the most important one is exit code 2, which has a significant impact on our workflows.
00:12:10So when we use exit code 2 with any tool, the error message is actually fed back to claud,
00:12:15and it is forced to act upon that error message.
00:12:17For example, there are often times when you want to use a certain library, but claud uses
00:12:21another one because of its training patterns.
00:12:24To prevent this, you can configure a hook for that and have it run before every bash command.
00:12:28It checks if the command claud is about to use matches the library you don't want to use,
00:12:33as in my case it was pip, and then it prints a message telling it not to use pip and directs
00:12:37it to use uvicorn instead, and exits with code 2.
00:12:41With this in place, whenever claud tries to install through pip, it will be forced to install
00:12:45through uvicorn instead.
00:12:46These hooks with exit codes form the basis of ralfloops, which you might remember were
00:12:50gaining a lot of traction a little while back.
00:12:52We also made a video on them in detail which you can check out on our channel.
00:12:56They use the same mechanism of exit codes and hooks to force claud to keep iterating until
00:13:01the criteria for a complete output has been met.
00:13:03This ensures that claud doesn't slack off and mark incomplete tasks as complete.
00:13:08These hooks can help in creating multiple similar workflows.
00:13:11That brings us to the end of this video.
00:13:13If you'd like to support the channel and help us keep making videos like this, you can do
00:13:17so by using the super thanks button below.
00:13:19As always, thank you for watching and I'll see you in the next one.

Key Takeaway

Users can significantly enhance Claude Code performance and privacy by unlocking hidden configuration files, adjusting context limits, and implementing custom hooks for automated workflow control.

Highlights

Modify settings.json to extend conversation retention beyond the 30-day default and increase bash output limits up to 150,000 characters.

Implement file-specific rules and path-specific instructions to maintain agent focus and prevent context dilution in large projects.

Bypass the 2,000-line file reading limit by using Claude.md instructions and hooks with offset and limit parameters.

Utilize advanced sub-agent configurations including skill inheritance, effort levels, background execution, and isolated work trees.

Optimize output quality by adjusting the auto-compact threshold from 95% down to 75% in the settings configuration.

Control privacy and attribution by disabling telemetry and removing co-author tags from GitHub commits via specific settings keys.

Manage multiple project environments and MCP server configurations seamlessly using the open-source Claude CTX tool.

Timeline

Configuring Retention and Terminal Limits

The video opens by identifying that many Claude Code issues are solved through hidden config files and environment variables. The speaker explains how to modify the 'cleanupPeriodDays' in settings.json to retain conversation history for up to a year, overcoming the one-month default. Furthermore, the default 30,000-character limit for bash command outputs is addressed, suggesting an increase to 150,000 characters to leverage the 1 million token context window. This section also introduces path-specific rules to keep the agent focused on relevant files, such as React components, rather than loading an entire massive codebase. Proper separation of concerns prevents Claude from ignoring instructions due to oversized context files.

Advanced Sub-Agent and Tool Management

This segment focuses on delegating tasks to specialized sub-agents using the 'agent' flag to reduce overhead. It covers sophisticated configurations like skill inheritance, background execution, and the 'effort' setting which determines token and thinking power. A critical feature mentioned is 'isolation', where agents work in a temporary work tree to experiment with code without risking the main repository. The speaker also explains how to restrict which agents can spawn others to prevent 'rogue' agent loops. These granular controls allow for a more professional and safe automated development environment.

Overcoming File Limits and Optimizing Compactness

The speaker reveals a major limitation where Claude only reads 2,000 lines of a file, often missing critical data without alerting the user. To fix this, the video demonstrates a workaround using Claude.md instructions and hooks that utilize 'HEAD' or offset parameters for large files. Additionally, the default auto-compact trigger at 95% context usage is criticized for causing output degradation. The recommendation is to set the 'autoCompactPercentageOverride' to 75% to maintain high-quality reasoning. This ensures the model stays sharp and doesn't get 'lost' in an nearly full context window.

Agent Teams and Profile Management Tools

A distinction is made between sub-agents and experimental 'Agent Teams', where team members can communicate and share information under a leader. The video introduces 'Claude CTX', an open-source tool that manages different profiles for various clients or projects. Claude CTX allows users to switch between isolated settings.json and Claude.md files, ensuring permissions and tools do not bleed across environments. It also includes a backup system that saves the current state when switching profiles. This approach is highly recommended for developers juggling multiple professional contexts.

Privacy, Attribution, and Workflow Hooks

The final section covers GitHub integration and privacy settings, showing how to disable the 'co-author' attribution in commits and PRs. It details how to opt out of telemetry and error reporting to Statseg and Sentry by adding specific variables to settings.json, which is safer than using the CLI flag that blocks updates. The video concludes with a deep dive into shell hooks and exit codes, specifically 'exit code 2' which forces Claude to act on error messages. This mechanism is the foundation for 'ralfloops', which ensure Claude iterates on a task until specific criteria are met. These advanced techniques prevent the AI from marking incomplete work as finished.

Community Posts

View all posts