@@ -398,18 +398,19 @@ def resolve_skill_placeholders(
398398
399399 body = body .replace ("{ARGS}" , "$ARGUMENTS" ).replace ("__AGENT__" , agent_name )
400400
401- # Resolve __CONTEXT_FILE__ from the agent-context extension config
402- # when enabled. Fall back to init-options.json for projects that
403- # haven't migrated or that explicitly disabled the extension.
401+ # Resolve __CONTEXT_FILE__ from the agent-context extension config.
402+ # When disabled, ignore stale context_files but keep the singular
403+ # context_file value so generated commands still point at the agent
404+ # context file managed before the extension was disabled.
404405 context_file = ""
405406 from .integrations .base import IntegrationBase
406407
407- if IntegrationBase ._agent_context_extension_enabled (project_root ):
408- # Local import: _load_agent_context_config lives in __init__.py which
409- # imports agents.py, so a top-level import would be circular.
410- from . import _load_agent_context_config
408+ # Local import: _load_agent_context_config lives in __init__.py which
409+ # imports agents.py, so a top-level import would be circular.
410+ from . import _load_agent_context_config
411411
412- ac_cfg = _load_agent_context_config (project_root )
412+ ac_cfg = _load_agent_context_config (project_root )
413+ if IntegrationBase ._agent_context_extension_enabled (project_root ):
413414 context_files = ac_cfg .get ("context_files" )
414415 if isinstance (context_files , list ):
415416 context_file_values = []
@@ -435,6 +436,10 @@ def resolve_skill_placeholders(
435436 context_file = IntegrationBase ._validate_context_file_path (
436437 project_root , candidate
437438 )
439+ else :
440+ configured_context_file = ac_cfg .get ("context_file" )
441+ if isinstance (configured_context_file , str ):
442+ context_file = configured_context_file .strip ()
438443 if not context_file :
439444 context_file = init_opts .get ("context_file" ) or ""
440445 body = body .replace ("__CONTEXT_FILE__" , context_file )
0 commit comments