1
>
/*---------------------------------------------------------------------------------------------
claudeRuleScan.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { URI } from '../../../../../../base/common/uri.js';
7
>
import { basename } from '../../../../../../base/common/resources.js';
8
>
import { IFileService } from '../../../../../files/common/files.js';
9
>
import { parseRuleFile, pathExists, type IParsedRule } from '../../../../../agentPlugins/common/pluginParsers.js';
10
>
import { CustomizationType } from '../../../../common/state/protocol/channels-session/state.js';
11
>
import { customizationId, type RuleCustomization } from '../../../../common/state/sessionState.js';
12
>
13
>
/**
14
>
* The CLAUDE.md memory files a session loads as always-on rules. The
15
>
* documented primary locations only — user `~/.claude/CLAUDE.md`, project
16
>
* `./CLAUDE.md` / `./.claude/CLAUDE.md`, and the personal `./CLAUDE.local.md`.
17
>
* (Managed-policy OS-level CLAUDE.md and the ancestor-directory walk are
18
>
* intentionally out of scope.)
19
>
*
20
>
* Exported so the change-watcher can reuse the exact same list and never
21
>
* drift from what {@link scanClaudeRules} actually reads.
22
>
*/
23
>
export function claudeMemoryFiles(workingDirectory: URI | undefined, userHome: URI): URI[] {
24
const files = [URI.joinPath(userHome, '.claude', 'CLAUDE.md')];
25
if (workingDirectory) {