Skip to content

fix(continuous-learning-v2): honor non-git CLAUDE_PROJECT_DIR in project detection - #2488

Merged
affaan-m merged 2 commits into
affaan-m:mainfrom
gaurav0107:fix/2469-non-git-project-detection
Jul 26, 2026
Merged

affaan-m merged 2 commits into
affaan-m:mainfrom
gaurav0107:fix/2469-non-git-project-detection

Conversation

@gaurav0107

Copy link
Copy Markdown
Contributor

What Changed

_clv2_detect_project in skills/continuous-learning-v2/scripts/detect-project.sh now honors an explicitly-provided CLAUDE_PROJECT_DIR as a project root even when it is not a git repository. Previously the Priority-1 branch was gated on command -v git and derived project_root only from git rev-parse --show-toplevel, so a non-git directory yielded nothing and detection fell through to the shared global bucket.

The fix canonicalizes the directory (pwd -P) and reuses the existing SHA256→12-char path-hash logic — the same code path already used for remote-less git repos — to derive a stable per-path project_id.

Why This Change

Fixes #2469. Any working directory that is not a git repo — including one explicitly passed via CLAUDE_PROJECT_DIR — collapsed into the hardcoded global scope, so all non-git projects shared a single observation/instinct bucket and any instincts learned there applied everywhere. That defeats v2.1's project isolation for users whose projects are not under git, and it made the documented "Priority 1: CLAUDE_PROJECT_DIR" misleading (it implied an explicit override but still required a git repo).

Git repositories behave exactly as before. Priority 2 (cwd) stays git-only on purpose, so an arbitrary non-git working directory never becomes a "project" — the new behavior is gated on the explicit CLAUDE_PROJECT_DIR env var, matching the reporter's recommended opt-in.

Testing Done

  • node tests/run-all.js3110 passed, 0 failed (clean env).
  • New tests/hooks/detect-project-nongit.test.js (5 cases): non-git CLAUDE_PROJECT_DIR yields a non-global, 12-hex, path-derived PROJECT_ID; PROJECT_NAME == basename; hash stable across runs; distinct dirs → distinct IDs; a bare non-git cwd with no CLAUDE_PROJECT_DIR still stays global (gating).
  • Existing tests/hooks/detect-project-worktree.test.js still passes (git/worktree path unchanged).
  • npx eslint tests/hooks/detect-project-nongit.test.js, npx markdownlint skills/continuous-learning-v2/SKILL.md, and validate-skills / validate-hooks / catalog / validate-no-personal-paths / check-unicode-safety all green.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation

Security & Quality Checklist

  • No secrets, credentials, or personal absolute paths introduced (tests use os.tmpdir())
  • Change is surgical and backward-compatible (git detection unchanged)
  • New behavior covered by an integration test under tests/hooks/
  • Shell change stays POSIX/bash-safe; no new external dependencies
  • Full suite green in a clean environment

Documentation

Updated the SKILL.md project-detection priority list so the CLAUDE_PROJECT_DIR override is no longer documented as git-only.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7bc9bcf7-a360-4349-9205-c160264a183c

📥 Commits

Reviewing files that changed from the base of the PR and between 58641e2 and 1f1ebf2.

📒 Files selected for processing (4)
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
📜 Recent review details
⏰ Context from checks skipped due to timeout. (7)
  • GitHub Check: Greptile Review
  • GitHub Check: Test (macos-latest, Node 20.x, yarn)
  • GitHub Check: Test (macos-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, yarn)
  • GitHub Check: Test (windows-latest, Node 18.x, yarn)
  • GitHub Check: Test (macos-latest, Node 22.x, yarn)
  • GitHub Check: Test (macos-latest, Node 20.x, npm)
🧰 Additional context used
📓 Path-based instructions (21)
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Before running shell commands, explain destructive or networked actions and prefer read-only inspection first

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

New workflow contributions should land in skills/ first; skills/ is the canonical workflow surface.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/instinct-cli.py
skills/**/scripts/**

⚙️ CodeRabbit configuration file

skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • tests/hooks/detect-project-nongit.test.js
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • tests/hooks/detect-project-nongit.test.js
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • tests/hooks/detect-project-nongit.test.js
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • tests/hooks/detect-project-nongit.test.js
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • tests/hooks/detect-project-nongit.test.js
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/hooks/detect-project-nongit.test.js
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/continuous-learning-v2/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/continuous-learning-v2/SKILL.md
**/*.{py,pyi}

📄 CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

**/*.{py,pyi}: Follow PEP 8 conventions in Python code
Use type annotations on all function signatures in Python
Prefer immutable data structures such as frozen dataclasses and NamedTuple in Python

**/*.{py,pyi}: Auto-format Python files using black/ruff after edit
Run type checking using mypy/pyright after editing Python files

**/*.{py,pyi}: Use Protocol from typing module for duck typing and defining object shapes in Python
Use dataclasses with @dataclass decorator for DTOs (Data Transfer Objects) in Python
Use context managers (with statement) for resource management in Python
Use generators for lazy evaluation and memory-efficient iteration in Python

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

**/*.py: Use black for code formatting in Python
Use isort for import sorting in Python
Use ruff for linting Python code

Avoid using print() statements in Python code; use the logging module instead

**/*.py: Retrieve secrets and API keys from environment variables using os.environ with error handling (raise KeyError if missing) rather than hardcoding credentials
Use bandit for static security analysis in Python projects

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
🧠 Learnings (4)
📚 Learning: 2026-06-27T23:49:19.839Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2373
File: tests/hooks/observe-signal-timeout.test.js:0-0
Timestamp: 2026-06-27T23:49:19.839Z
Learning: In tests under tests/hooks that require a Python runtime to run, the test should fail fast when Python isn’t available (or prerequisites aren’t met). Do not treat a missing Python runtime as test.skip, as an expected/allowed condition, or as a passing state; instead, explicitly fail (e.g., throw/return a rejected promise or use a test runner fail/expect that marks the test as failed) so reviewers can’t accidentally mask environment issues.

Applied to files:

  • tests/hooks/detect-project-nongit.test.js
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-06-27T15:41:48.588Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2369
File: skills/continuous-learning-v2/scripts/test_parse_instinct.py:1056-1082
Timestamp: 2026-06-27T15:41:48.588Z
Learning: In this repo, the Ruff configuration for Python files under `skills/continuous-learning-v2/scripts/` selects only `E/F/I/N/W/UP`, and `flake8-pytest-style` (e.g., `PT018`) is not enabled. During code review for files in this directory, don’t assume `PT018` will be enforced by CI/ruff; only raise/test for issues that are covered by the enabled Ruff rules (or confirm the relevant rule is enabled before relying on it).

Applied to files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
🪛 ast-grep (0.44.1)
tests/hooks/detect-project-nongit.test.js

[warning] 23-23: Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: require('child_process')
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process)


[warning] 150-150: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(detectProjectPath, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename)

🪛 SkillSpector (2.3.7)
skills/continuous-learning-v2/SKILL.md

[error] 160: [AS1] Agent Config Directory Access: Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Remediation: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variables — never read the agent's own config files.

(Agent Snooping (AS1))


[warning] 315: [EA2] Autonomous Decision Making: Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Remediation: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.

(Excessive Agency (EA2))


[warning] 132: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🔇 Additional comments (5)
skills/continuous-learning-v2/scripts/detect-project.sh (1)

108-124: LGTM!

skills/continuous-learning-v2/scripts/instinct-cli.py (1)

301-313: LGTM!

skills/continuous-learning-v2/SKILL.md (1)

131-131: LGTM!

tests/hooks/detect-project-nongit.test.js (2)

1-291: LGTM!


108-144: 🎯 Functional Correctness

No issue here: detect-project.sh already exports PROJECT_ID/PROJECT_NAME/PROJECT_ROOT, and _main_worktree_root() falls back to project_root when git lookup fails, so the shell and Python hash inputs stay aligned for non-git directories.

			> Likely an incorrect or invalid review comment.

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved project detection so an explicitly set project directory works even when Git isn’t available.
    • Non-Git project directories now use a stable, path-based project ID and matching project root, instead of reverting to the shared default.
    • Project names now reflect the specified directory’s basename.
  • Documentation
    • Clarified that the directory override is the highest-priority setting and that the project ID is computed from the directory’s absolute path.
  • Tests
    • Added automated tests covering non-Git directories, stability across runs, differentiation across directories, and consistency with the Python implementation.

Walkthrough

CLAUDE_PROJECT_DIR now resolves explicit non-git directories as project roots in both shell and Python detection paths. The docs were updated, and a new test file validates project identity, fallback, stability, and cross-implementation consistency.

Changes

Non-git project detection fallback

Layer / File(s) Summary
Detection logic and documentation update
skills/continuous-learning-v2/scripts/detect-project.sh, skills/continuous-learning-v2/scripts/instinct-cli.py, skills/continuous-learning-v2/SKILL.md
CLAUDE_PROJECT_DIR now falls back to the directory’s resolved path when git cannot supply a toplevel, and the project detection docs describe that override and hash basis.
Test harness and script probe
tests/hooks/detect-project-nongit.test.js
Adds the test runner scaffolding, bash harness, Python comparison helper, temp-dir helpers, Windows guard, and a content check for the new fallback path.
Non-git detection assertions
tests/hooks/detect-project-nongit.test.js
Verifies explicit non-git CLAUDE_PROJECT_DIR IDs, basename naming, stability, uniqueness, global fallback when unset, cross-checks against the Python CLI, and final pass/fail exit handling.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

  • affaan-m/ECC#2009: Both PRs adjust skills/continuous-learning-v2/scripts/detect-project.sh / instinct-cli.py project-root and project-id derivation for CLAUDE_PROJECT_DIR.

Suggested reviewers: affaan-m, daltino

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed It clearly summarizes the main fix: honoring non-git CLAUDE_PROJECT_DIR during project detection.
Description check ✅ Passed It accurately describes the project-detection fix and the related tests/documentation changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ecc-tools

ecc-tools Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@gaurav0107
gaurav0107 marked this pull request as ready for review July 9, 2026 19:17
@gaurav0107
gaurav0107 requested a review from affaan-m as a code owner July 9, 2026 19:17
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes issue #2469 where CLAUDE_PROJECT_DIR pointing at a non-git directory was ignored, causing all such projects to collapse into the shared global bucket and contaminating each other's learned instincts.

  • detect-project.sh: when git rev-parse yields nothing for CLAUDE_PROJECT_DIR, a new fallback resolves the canonical path via cd "$CLAUDE_PROJECT_DIR" && pwd -P and tags it source_hint="env-nogit", feeding the existing SHA256 → 12-char path-hash pipeline.
  • instinct-cli.py: mirrors the shell change with os.path.realpath(env_dir), keeping the Python CLI's project IDs in sync with the shell observer for the same directory.
  • Tests: five integration cases verify non-global ID format, cross-run stability, per-directory uniqueness, bare-cwd gating (no unintended promotion of arbitrary non-git dirs), and shell/Python cross-implementation agreement.

Confidence Score: 5/5

Safe to merge — the change is a surgical two-file fix gated on the explicit CLAUDE_PROJECT_DIR env var, backward-compatible for all git-based paths, and covered by a dedicated integration test.

The shell and Python implementations are symmetric and agree on the canonical-path identity. The hash derivation and registry update paths are untouched. No unintended promotion of arbitrary non-git working directories is possible. Full suite green including new cross-impl consistency tests.

No files require special attention.

Important Files Changed

Filename Overview
skills/continuous-learning-v2/scripts/detect-project.sh Priority-1 branch now falls through to a cd ... && pwd -P canonical-path identity when git is absent or doesn't recognise CLAUDE_PROJECT_DIR; hash derivation and registry update paths are unchanged and correct.
skills/continuous-learning-v2/scripts/instinct-cli.py Python equivalent mirrors the shell change: os.path.realpath(env_dir) is used when _git_repo_root(env_dir) returns None, keeping the project IDs in sync between the shell observer and the Python CLI.
tests/hooks/detect-project-nongit.test.js New integration test adds five well-structured cases: non-global hash format, stability across runs, distinct-dir isolation, bare-cwd gating, and cross-impl consistency between shell and Python; os.tmpdir() and cleanup on exit keep it side-effect-free.
skills/continuous-learning-v2/SKILL.md Priority-1 entry updated to document the non-git override; wording accurately reflects the new behaviour.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_clv2_detect_project called] --> B{CLV2_NO_PROJECT=1?}
    B -- yes --> Z[project_id = global]
    B -- no --> C{CLAUDE_PROJECT_DIR set and is a directory?}
    C -- no --> F
    C -- yes --> D{git available?}
    D -- yes --> E[git rev-parse --show-toplevel from CLAUDE_PROJECT_DIR]
    E -- success --> G[source_hint = env / project_root = git toplevel]
    E -- fails --> H[NEW: cd CLAUDE_PROJECT_DIR and pwd -P]
    D -- no --> H
    H -- success --> I[source_hint = env-nogit / project_root = canonical path]
    H -- fails --> F
    G --> J
    I --> J
    F{project_root empty?} -- check cwd git --> K[git rev-parse --show-toplevel from cwd]
    K -- success --> L[source_hint = git / project_root = cwd git root]
    K -- fails --> Z
    J[Derive project_name from basename] --> M{remote URL available?}
    L --> M
    M -- yes --> N[hash_input = normalized remote URL]
    M -- no --> O[hash_input = fallback_root path]
    N --> P[SHA256 to 12-char project_id]
    O --> P
    P --> Q[Export _CLV2_PROJECT_ID NAME ROOT DIR]
Loading

Reviews (5): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/hooks/detect-project-nongit.test.js`:
- Around line 76-81: The test setup in detect-project-nongit.test.js is hiding
all stderr output from sourcing detect-project.sh, which makes sourcing failures
impossible to diagnose. Update the script string around the detectProjectPath
source step to stop redirecting stderr to /dev/null, or redirect only stdout and
keep stderr available for diagnostics. Preserve the existing PROJECT_ID,
PROJECT_NAME, and PROJECT_ROOT checks so failures in sourcing can surface
clearly when running the test.
- Around line 15-18: The Windows guard in detect-project-nongit.test.js is
hiding missing prerequisites by exiting successfully, so update the
process.platform === 'win32' branch to fail fast or emit an explicit skip
warning that CI can detect. Adjust the top-level test setup in this file so the
bash-dependent check does not silently pass on Windows, and keep the behavior
consistent with other tests under tests/hooks that require unmet prerequisites
to report clearly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 437692fc-9e0f-412e-9a34-756a524544bd

📥 Commits

Reviewing files that changed from the base of the PR and between 4092795 and daa4fb6.

📒 Files selected for processing (3)
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • tests/hooks/detect-project-nongit.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (9)
  • GitHub Check: Greptile Review
  • GitHub Check: Test (macos-latest, Node 22.x, bun)
  • GitHub Check: Test (macos-latest, Node 22.x, yarn)
  • GitHub Check: Test (macos-latest, Node 22.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, yarn)
  • GitHub Check: Test (macos-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, npm)
🧰 Additional context used
📓 Path-based instructions (19)
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/continuous-learning-v2/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/continuous-learning-v2/SKILL.md
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

New workflow contributions should land in skills/ first; skills/ is the canonical workflow surface.

Files:

  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Before running shell commands, explain destructive or networked actions and prefer read-only inspection first

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
skills/**/scripts/**

⚙️ CodeRabbit configuration file

skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
🧠 Learnings (3)
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-06-27T23:49:19.839Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2373
File: tests/hooks/observe-signal-timeout.test.js:0-0
Timestamp: 2026-06-27T23:49:19.839Z
Learning: In tests under tests/hooks that require a Python runtime to run, the test should fail fast when Python isn’t available (or prerequisites aren’t met). Do not treat a missing Python runtime as test.skip, as an expected/allowed condition, or as a passing state; instead, explicitly fail (e.g., throw/return a rejected promise or use a test runner fail/expect that marks the test as failed) so reviewers can’t accidentally mask environment issues.

Applied to files:

  • tests/hooks/detect-project-nongit.test.js
🪛 ast-grep (0.44.1)
tests/hooks/detect-project-nongit.test.js

[warning] 103-103: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(detectProjectPath, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename)


[warning] 23-23: Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: require('child_process')
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process)

🪛 SkillSpector (2.3.7)
skills/continuous-learning-v2/SKILL.md

[error] 160: [AS1] Agent Config Directory Access: Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Remediation: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variables — never read the agent's own config files.

(Agent Snooping (AS1))


[warning] 315: [EA2] Autonomous Decision Making: Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Remediation: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.

(Excessive Agency (EA2))


[warning] 132: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🔇 Additional comments (4)
skills/continuous-learning-v2/scripts/detect-project.sh (1)

108-124: LGTM!

skills/continuous-learning-v2/SKILL.md (1)

131-131: LGTM!

tests/hooks/detect-project-nongit.test.js (2)

29-39: LGTM!

Also applies to: 64-97, 103-196, 198-203


76-81: 🎯 Functional Correctness

No issue with the variable mapping. detect-project.sh assigns PROJECT_ID, PROJECT_NAME, and PROJECT_ROOT from the _CLV2_ variables before the test reads them.

			> Likely an incorrect or invalid review comment.

Comment thread tests/hooks/detect-project-nongit.test.js
Comment thread tests/hooks/detect-project-nongit.test.js
@gaurav0107
gaurav0107 force-pushed the fix/2469-non-git-project-detection branch from daa4fb6 to 976b3d6 Compare July 9, 2026 19:33
@ecc-tools

ecc-tools Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/continuous-learning-v2/scripts/detect-project.sh`:
- Around line 108-124: Mirror the non-git CLAUDE_PROJECT_DIR fallback in
detect_project() inside instinct-cli.py so it behaves like detect-project.sh:
when CLAUDE_PROJECT_DIR is set to a valid non-git directory, treat that resolved
path as the project root instead of dropping back to cwd/global. Update the
project-root detection logic and source hint handling in detect_project() so
env-nogit is recognized consistently with the shell script and
observations/instincts stay grouped under the same project.

In `@tests/hooks/detect-project-nongit.test.js`:
- Around line 116-142: Add a PROJECT_ROOT assertion in the non-git detection
test so the detect() helper’s path resolution is validated alongside PROJECT_ID
and PROJECT_NAME. In the detect-project-nongit test case, verify that
PROJECT_ROOT matches the pwd -P-resolved absolute path of CLAUDE_PROJECT_DIR for
the non-git branch, using the existing detect() helper and the temp projectDir
setup to catch symlink or trailing-slash resolution bugs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ede3aa2c-3ba0-488e-a002-ac29b8ace68e

📥 Commits

Reviewing files that changed from the base of the PR and between daa4fb6 and 976b3d6.

📒 Files selected for processing (3)
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • tests/hooks/detect-project-nongit.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (28)
  • GitHub Check: Greptile Review
  • GitHub Check: Test (windows-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, npm)
  • GitHub Check: Test (macos-latest, Node 20.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, npm)
  • GitHub Check: Test (macos-latest, Node 22.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, bun)
  • GitHub Check: Test (windows-latest, Node 20.x, npm)
  • GitHub Check: Test (windows-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, yarn)
  • GitHub Check: Test (macos-latest, Node 20.x, bun)
  • GitHub Check: Test (macos-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, yarn)
  • GitHub Check: Test (windows-latest, Node 20.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, bun)
  • GitHub Check: Test (macos-latest, Node 20.x, npm)
  • GitHub Check: Test (windows-latest, Node 22.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 22.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, bun)
  • GitHub Check: Test (windows-latest, Node 18.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, npm)
  • GitHub Check: Test (windows-latest, Node 18.x, yarn)
  • GitHub Check: Coverage
🧰 Additional context used
📓 Path-based instructions (19)
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Before running shell commands, explain destructive or networked actions and prefer read-only inspection first

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

New workflow contributions should land in skills/ first; skills/ is the canonical workflow surface.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/SKILL.md
skills/**/scripts/**

⚙️ CodeRabbit configuration file

skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/SKILL.md
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/hooks/detect-project-nongit.test.js
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/continuous-learning-v2/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/continuous-learning-v2/SKILL.md
🧠 Learnings (3)
📚 Learning: 2026-06-27T23:49:19.839Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2373
File: tests/hooks/observe-signal-timeout.test.js:0-0
Timestamp: 2026-06-27T23:49:19.839Z
Learning: In tests under tests/hooks that require a Python runtime to run, the test should fail fast when Python isn’t available (or prerequisites aren’t met). Do not treat a missing Python runtime as test.skip, as an expected/allowed condition, or as a passing state; instead, explicitly fail (e.g., throw/return a rejected promise or use a test runner fail/expect that marks the test as failed) so reviewers can’t accidentally mask environment issues.

Applied to files:

  • tests/hooks/detect-project-nongit.test.js
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
🪛 ast-grep (0.44.1)
tests/hooks/detect-project-nongit.test.js

[warning] 23-23: Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: require('child_process')
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process)


[warning] 106-106: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(detectProjectPath, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename)

🪛 SkillSpector (2.3.7)
skills/continuous-learning-v2/SKILL.md

[error] 160: [AS1] Agent Config Directory Access: Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Remediation: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variables — never read the agent's own config files.

(Agent Snooping (AS1))


[warning] 315: [EA2] Autonomous Decision Making: Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Remediation: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.

(Excessive Agency (EA2))


[warning] 132: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🔇 Additional comments (2)
skills/continuous-learning-v2/scripts/detect-project.sh (1)

108-124: LGTM!

skills/continuous-learning-v2/SKILL.md (1)

131-131: LGTM!

Comment thread skills/continuous-learning-v2/scripts/detect-project.sh
Comment thread tests/hooks/detect-project-nongit.test.js
@gaurav0107
gaurav0107 force-pushed the fix/2469-non-git-project-detection branch from 976b3d6 to 58641e2 Compare July 9, 2026 19:54
@ecc-tools

ecc-tools Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/hooks/detect-project-nongit.test.js`:
- Around line 251-255: The cross-implementation test in
detect-project-nongit.test.js is silently treated as passed when PYTHON is
missing because the `instinct-cli.py assigns the same non-global id as
detect-project.sh` test returns early. Update that test to fail fast when
`PYTHON` is null, or explicitly report it as skipped in the test harness instead
of letting the runner count it as passed; if you choose the skip path, adjust
the results summary logic alongside the runner that increments `passed` so
skipped Python-dependent tests are tracked separately.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e3f14105-6129-44b8-b99a-733a156539ab

📥 Commits

Reviewing files that changed from the base of the PR and between 976b3d6 and 58641e2.

📒 Files selected for processing (4)
  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (28)
  • GitHub Check: Greptile Review
  • GitHub Check: Test (windows-latest, Node 22.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, bun)
  • GitHub Check: Test (macos-latest, Node 22.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 20.x, bun)
  • GitHub Check: Test (macos-latest, Node 18.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, yarn)
  • GitHub Check: Test (windows-latest, Node 20.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 18.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 20.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, bun)
  • GitHub Check: Test (macos-latest, Node 18.x, bun)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 22.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, yarn)
  • GitHub Check: Test (windows-latest, Node 20.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, bun)
  • GitHub Check: Coverage
🧰 Additional context used
📓 Path-based instructions (21)
skills/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.

Files:

  • skills/continuous-learning-v2/SKILL.md
{agents,skills,commands}/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Use lowercase filenames with hyphens (e.g., python-reviewer.md, tdd-workflow.md) for agents, skills, and commands.

Files:

  • skills/continuous-learning-v2/SKILL.md
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

New workflow contributions should land in skills/ first; skills/ is the canonical workflow surface.

Files:

  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
{skills,commands,agents,rules}/**

⚙️ CodeRabbit configuration file

{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.

Files:

  • skills/continuous-learning-v2/SKILL.md
  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.sh

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Before running shell commands, explain destructive or networked actions and prefer read-only inspection first

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
skills/**/scripts/**

⚙️ CodeRabbit configuration file

skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.

Files:

  • skills/continuous-learning-v2/scripts/detect-project.sh
  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
  • tests/hooks/detect-project-nongit.test.js
**/*.{py,pyi}

📄 CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

**/*.{py,pyi}: Follow PEP 8 conventions in Python code
Use type annotations on all function signatures in Python
Prefer immutable data structures such as frozen dataclasses and NamedTuple in Python

**/*.{py,pyi}: Auto-format Python files using black/ruff after edit
Run type checking using mypy/pyright after editing Python files

**/*.{py,pyi}: Use Protocol from typing module for duck typing and defining object shapes in Python
Use dataclasses with @dataclass decorator for DTOs (Data Transfer Objects) in Python
Use context managers (with statement) for resource management in Python
Use generators for lazy evaluation and memory-efficient iteration in Python

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

**/*.py: Use black for code formatting in Python
Use isort for import sorting in Python
Use ruff for linting Python code

Avoid using print() statements in Python code; use the logging module instead

**/*.py: Retrieve secrets and API keys from environment variables using os.environ with error handling (raise KeyError if missing) rather than hardcoding credentials
Use bandit for static security analysis in Python projects

Files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/hooks/detect-project-nongit.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/hooks/detect-project-nongit.test.js
🧠 Learnings (4)
📚 Learning: 2026-03-15T19:02:43.245Z
Learnt from: imrobinsingh
Repo: affaan-m/everything-claude-code PR: 503
File: skills/data-scraper-agent/SKILL.md:1-748
Timestamp: 2026-03-15T19:02:43.245Z
Learning: In this repository, skill folders should use a lowercase-hyphen name (e.g., data-scraper-agent, claude-api) and the skill description file inside each folder should be named SKILL.md (uppercase). Do not flag SKILL.md as a naming violation; treat SKILL.md as the canonical file name inside each skill directory.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-04-15T15:52:59.963Z
Learnt from: manja316
Repo: affaan-m/everything-claude-code PR: 1360
File: skills/security-bounty-hunter/SKILL.md:11-18
Timestamp: 2026-04-15T15:52:59.963Z
Learning: In this repository’s skills documentation (skills/**/SKILL.md), use the canonical auto-activation skill section header `## When to Activate`—do not use `## When to Use`. CONTRIBUTING.md and docs/SKILL-DEVELOPMENT-GUIDE.md confirm the required header, and existing skills follow this convention. This header is important for the auto-activation mechanism to detect the correct section.

Applied to files:

  • skills/continuous-learning-v2/SKILL.md
📚 Learning: 2026-06-27T15:41:48.588Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2369
File: skills/continuous-learning-v2/scripts/test_parse_instinct.py:1056-1082
Timestamp: 2026-06-27T15:41:48.588Z
Learning: In this repo, the Ruff configuration for Python files under `skills/continuous-learning-v2/scripts/` selects only `E/F/I/N/W/UP`, and `flake8-pytest-style` (e.g., `PT018`) is not enabled. During code review for files in this directory, don’t assume `PT018` will be enforced by CI/ruff; only raise/test for issues that are covered by the enabled Ruff rules (or confirm the relevant rule is enabled before relying on it).

Applied to files:

  • skills/continuous-learning-v2/scripts/instinct-cli.py
📚 Learning: 2026-06-27T23:49:19.839Z
Learnt from: gaurav0107
Repo: affaan-m/ECC PR: 2373
File: tests/hooks/observe-signal-timeout.test.js:0-0
Timestamp: 2026-06-27T23:49:19.839Z
Learning: In tests under tests/hooks that require a Python runtime to run, the test should fail fast when Python isn’t available (or prerequisites aren’t met). Do not treat a missing Python runtime as test.skip, as an expected/allowed condition, or as a passing state; instead, explicitly fail (e.g., throw/return a rejected promise or use a test runner fail/expect that marks the test as failed) so reviewers can’t accidentally mask environment issues.

Applied to files:

  • tests/hooks/detect-project-nongit.test.js
🪛 ast-grep (0.44.1)
tests/hooks/detect-project-nongit.test.js

[warning] 149-149: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(detectProjectPath, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename)


[warning] 23-23: Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: require('child_process')
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process)

🪛 SkillSpector (2.3.7)
skills/continuous-learning-v2/SKILL.md

[error] 160: [AS1] Agent Config Directory Access: Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Remediation: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variables — never read the agent's own config files.

(Agent Snooping (AS1))


[warning] 315: [EA2] Autonomous Decision Making: Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Remediation: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.

(Excessive Agency (EA2))


[warning] 132: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🔇 Additional comments (5)
skills/continuous-learning-v2/scripts/detect-project.sh (1)

108-124: LGTM!

skills/continuous-learning-v2/SKILL.md (1)

131-131: LGTM!

tests/hooks/detect-project-nongit.test.js (2)

159-190: LGTM!


192-247: LGTM!

skills/continuous-learning-v2/scripts/instinct-cli.py (1)

301-313: 🗄️ Data Integrity & Integration

Non-git fallback is safe. _main_worktree_root() returns project_root when git worktree list fails or produces no main root, so the CLAUDE_PROJECT_DIR non-git path still hashes a real string and cannot pass None into _project_hash().

			> Likely an incorrect or invalid review comment.

Comment thread tests/hooks/detect-project-nongit.test.js Outdated
…ect detection

Project detection only assigned a distinct project identity to git
repositories: when CLAUDE_PROJECT_DIR pointed at a non-git directory,
`git rev-parse --show-toplevel` returned empty, so detection dead-ended
at the shared `global` bucket and every non-git project shared one
observation/instinct scope — defeating v2.1 project isolation.

Honor an explicitly-provided, valid CLAUDE_PROJECT_DIR even when it is
not a git repo, in BOTH detection implementations so they stay in sync:

- detect-project.sh (shell observer): canonicalize the dir (`pwd -P`) and
  reuse the existing SHA256->12-char path-hash, the same code path already
  used for remote-less git repos.
- instinct-cli.py (Python CLI): mirror the fallback with
  os.path.realpath(env_dir), which matches the shell's `pwd -P`, so the
  observer and the CLI compute the SAME project id for the same directory
  and observations/instincts stay grouped (no split-brain).

Git repositories are unaffected. Priority 2 (cwd) stays git-only on
purpose, so an arbitrary non-git working directory never becomes a
"project" — the change is gated on the explicit env var.

- Adds tests/hooks/detect-project-nongit.test.js covering the non-global
  path-derived id, PROJECT_ROOT canonicalization, hash stability, per-dir
  distinctness, the still-global gating for a bare non-git cwd, and a
  shell-vs-Python cross-implementation consistency check.
- Clarifies the SKILL.md project-detection priority list so the
  CLAUDE_PROJECT_DIR override is no longer documented as git-only.
@gaurav0107
gaurav0107 force-pushed the fix/2469-non-git-project-detection branch from 58641e2 to 1f1ebf2 Compare July 9, 2026 20:13
@ecc-tools

ecc-tools Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@gaurav0107

Copy link
Copy Markdown
Contributor Author

Heads up on CI: the single red Windows job is a pre-existing, non-deterministic flake in tests/hooks/plugin-hook-bootstrap.test.js ("shell mode selects PowerShell when BASH is unset on Windows") — not from this change. It varies by which Windows Node/pkg-manager job runs (Node 20.x pnpm one run, Node 20.x npm another) while the identical siblings pass, and an earlier push of the same source (58641e2) went green across all 41 checks. The new tests here skip on win32 (process.platform === 'win32' guard), so they don't run on the Windows matrix at all. Local node tests/run-all.js is 3111/3111 green. Happy to rebase/re-run if a maintainer can re-trigger that job.

@ecc-tools

ecc-tools Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the explicit non-git CLAUDE_PROJECT_DIR path is canonicalized and hashed consistently in both shell and Python implementations, while an arbitrary non-git cwd remains in global scope. The focused stability/distinctness/cross-implementation tests are comprehensive and all 41 checks pass.

@affaan-m
affaan-m merged commit 5debb79 into affaan-m:main Jul 26, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project discovery is git-only: non-git projects all collapse into the shared global bucket

2 participants