Skip to content

Can't create AGENTS.md with /init #3147

Closed

Description

@somera

Hi,

I installed

$ opencode -v
0.15.0

on Windows 11 with scoop. And I run it with Ollama

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "edit": "ask",
    "bash": "ask"
  },
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "qwen2.5-coder:7b-instruct-q6_K": {
          "name": "Qwen2.5 Coder 7B (local)",
		  "tools": true,
		  "options": { "num_ctx": 12288 }
        },
		"qwen2.5-coder:14b-instruct-q6_K": {
          "name": "Qwen2.5 Coder 14B (local)",
		  "tools": true,
		  "options": { "num_ctx": 8192 }
        }
      }
    }
  },
  "model": "ollama/qwen2.5-coder:7b-instruct-q6_K"
}

I followed this https://opencode.ai/docs/#initialize but after /init I don't see AGENTS.md.

Image

Activity

  1. github-actions commented on Oct 13, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The common thread appears to be /init command failures on Windows systems, particularly with local providers like Ollama. Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Contributor

    @somera so this is the model failing to call tools correctly, when you setup ollama did you set num_ctx?

    My general advice is to try increasing num_ctx in Ollama. Start around 16k - 32k.

    I added this to docs but Ig they weren't published yet

  3. self-assigned this
    on Oct 13, 2025
  4. somera commented on Oct 13, 2025

    @somera
    Author

    @rekram1-node thi, I will try it later.

    Now I'm testing it with other Windows 11 system, ollama and qwen3-coder:30b and gtp-oss:20b.

    Curl is working fine:

    $ curl http://10.53.200.243:11434/v1/chat/completions     -H "Content-Type: application/json"     -d '{
            "model": "qwen3-coder:30b",
            "messages": [
                {
                    "role": "system",
                    "content": "You are a helpful assistant."
                },
                {
                    "role": "user",
                    "content": "Hello!"
                }
            ]
        }'
    {"id":"chatcmpl-921","object":"chat.completion","created":1760383926,"model":"qwen3-coder:30b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! How can I help you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":21,"completion_tokens":10,"total_tokens":31}}
    

    But opencode can't communicate with ollama backend. I don't see nothing in tui and log. No errors. I started it with opencode --log-level DEBUG:

    INFO  2025-10-13T19:29:52 +74575ms service=server method=POST path=/session request
    INFO  2025-10-13T19:29:52 +4ms service=session id=ses_620f309ecffeODWceF87weZNIX version=0.15.0 projectID=global directory=C:\repos\_ai\tic_tac_toe_aged3 title=New session - 2025-10-13T19:29:52.659Z time={"created":1760383792659,"updated":1760383792659} created
    INFO  2025-10-13T19:29:52 +1ms service=bus type=session.updated publishing
    INFO  2025-10-13T19:29:52 +1ms service=server duration=6 response
    INFO  2025-10-13T19:29:52 +1ms service=server method=POST path=/session/ses_620f309ecffeODWceF87weZNIX/init request
    INFO  2025-10-13T19:29:52 +0ms service=session.prompt session=ses_620f309ecffeODWceF87weZNIX prompt
    INFO  2025-10-13T19:29:52 +2ms service=bus type=message.updated publishing
    DEBUG 2025-10-13T19:29:52 +9ms service=tui timeTakenMs=0 messages.renderView
    DEBUG 2025-10-13T19:29:52 +1ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:52 +0ms service=bus type=message.part.updated publishing
    DEBUG 2025-10-13T19:29:52 +1ms service=tui message=msg_9df0cf616001g81EYLXC6FbEcv part=prt_9df0cf6160016qPkK26EWleWwN message part updated
    INFO  2025-10-13T19:29:52 +1ms service=bus type=session.updated publishing
    INFO  2025-10-13T19:29:52 +1ms service=provider providerID=ollama modelID=qwen3-coder:30b getModel
    INFO  2025-10-13T19:29:52 +0ms service=provider status=started providerID=ollama getSDK
    DEBUG 2025-10-13T19:29:52 +0ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:52 +1ms service=bun pkg=@ai-sdk/openai-compatible version=latest installing package using Bun's default registry resolution
    INFO  2025-10-13T19:29:52 +0ms service=bun cmd=["C:\\Users\\user\\scoop\\apps\\opencode\\0.15.0\\opencode.exe","add","--force","--exact","--cwd","C:\\Users\\user\\.cache\\opencode","@ai-sdk/openai-compatible@latest"] cwd=C:\Users\user\.cache\opencode running
    DEBUG 2025-10-13T19:29:52 +9ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:55 +2817ms service=tui offset=0 x=27 y=46 mouse
    INFO  2025-10-13T19:29:55 +1ms service=tui end=-1,-1 start=27,46 mouse selection
    DEBUG 2025-10-13T19:29:55 +0ms service=tui timeTakenMs=0 messages.renderView
    DEBUG 2025-10-13T19:29:55 +153ms service=tui timeTakenMs=0 messages.renderView
    

    This is an enviroment with an proxy. And http_proxy, https_proxy are set.

    And this is my opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "edit": "ask",
        "bash": "ask"
      },
      "theme": "gruvbox",
      "provider": {
        "ollama": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Ollama",
          "options": {
            "baseURL": "http://10.53.200.243:11434/v1"
          },
          "models": {
            "gpt-oss:20b": {
              "name": "GPT-OSS 20B",
    		  "tools": true,
    		  "options": { "num_ctx": 16384 }
            },
    		"qwen3-coder:30b": {
              "name": "Qwen3-Coder 30B",
    		  "tools": true,
    		  "options": { "num_ctx": 16384 }
            }
          }
        }
      },
      "model": "ollama/qwen3-coder:30b"
    }
    
  5. somera commented on Oct 13, 2025

    @somera
    Author

    @somera so this is the model failing to call tools correctly, when you setup ollama did you set num_ctx?

    My general advice is to try increasing num_ctx in Ollama. Start around 16k - 32k.

    I added this to docs but Ig they weren't published yet

    The model I'm using, supports:

    $ ollama show qwen2.5-coder:14b-instruct-q6_K
      Model
        architecture        qwen2
        parameters          14.8B
        context length      32768
        embedding length    5120
        quantization        Q6_K
    

    This OLLAMA_CONTEXT_LENGTH=16384 OLLAMA_HOST=0.0.0.0 ollama serve is not helping.

    If num_ctx should be high, than I can forgot it with ollama, cause my GPU has only 16GB VRAM.

  6. somera commented on Oct 13, 2025

    @somera
    Author

    OK, next try with mistral:7b-instruct. Now I get real reponse:

    Image

    but I don's see AGENT.md in the project directory. Why?

  7. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Contributor

    That's because the model is lying

    When you work with these really small models on ollama and you don't adjust the num context I am pretty sure the tools aren't even introduced into their context so they can't take any actions << That's handled at the ollama level to opencode this is just any other model

  8. somera commented on Oct 13, 2025

    @somera
    Author

    @rekram1-node I understand.

    But I set num_ctx in opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "edit": "ask",
        "bash": "ask"
      },
      "provider": {
        "ollama": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Ollama (local)",
          "options": {
            "baseURL": "http://localhost:11434/v1"
          },
          "models": {
            "qwen2.5-coder:7b-instruct-q6_K": {
              "name": "Qwen2.5 Coder 7B (local)",
    		  "tools": true,
    		  "options": { "num_ctx": 12288 }
            },
    		"qwen2.5-coder:14b-instruct-q6_K": {
              "name": "Qwen2.5 Coder 14B (local)",
    		  "tools": true,
    		  "options": { "num_ctx": 8192 }
            }
          }
        }
      },
      "model": "ollama/qwen2.5-coder:7b-instruct-q6_K"
    }
    

    will this be used?

    But as I see, I can for got it with only 16GB VRAM.

    And I can set it on start OLLAMA_CONTEXT_LENGTH=16384 OLLAMA_HOST=0.0.0.0 ollama serve.

  9. somera commented on Oct 13, 2025

    @somera
    Author

    @rekram1-node thi, I will try it later.

    Now I'm testing it with other Windows 11 system, ollama and qwen3-coder:30b and gtp-oss:20b.

    Curl is working fine:

    $ curl http://10.53.200.243:11434/v1/chat/completions     -H "Content-Type: application/json"     -d '{
            "model": "qwen3-coder:30b",
            "messages": [
                {
                    "role": "system",
                    "content": "You are a helpful assistant."
                },
                {
                    "role": "user",
                    "content": "Hello!"
                }
            ]
        }'
    {"id":"chatcmpl-921","object":"chat.completion","created":1760383926,"model":"qwen3-coder:30b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! How can I help you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":21,"completion_tokens":10,"total_tokens":31}}
    

    But opencode can't communicate with ollama backend. I don't see nothing in tui and log. No errors. I started it with opencode --log-level DEBUG:

    INFO  2025-10-13T19:29:52 +74575ms service=server method=POST path=/session request
    INFO  2025-10-13T19:29:52 +4ms service=session id=ses_620f309ecffeODWceF87weZNIX version=0.15.0 projectID=global directory=C:\repos\_ai\tic_tac_toe_aged3 title=New session - 2025-10-13T19:29:52.659Z time={"created":1760383792659,"updated":1760383792659} created
    INFO  2025-10-13T19:29:52 +1ms service=bus type=session.updated publishing
    INFO  2025-10-13T19:29:52 +1ms service=server duration=6 response
    INFO  2025-10-13T19:29:52 +1ms service=server method=POST path=/session/ses_620f309ecffeODWceF87weZNIX/init request
    INFO  2025-10-13T19:29:52 +0ms service=session.prompt session=ses_620f309ecffeODWceF87weZNIX prompt
    INFO  2025-10-13T19:29:52 +2ms service=bus type=message.updated publishing
    DEBUG 2025-10-13T19:29:52 +9ms service=tui timeTakenMs=0 messages.renderView
    DEBUG 2025-10-13T19:29:52 +1ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:52 +0ms service=bus type=message.part.updated publishing
    DEBUG 2025-10-13T19:29:52 +1ms service=tui message=msg_9df0cf616001g81EYLXC6FbEcv part=prt_9df0cf6160016qPkK26EWleWwN message part updated
    INFO  2025-10-13T19:29:52 +1ms service=bus type=session.updated publishing
    INFO  2025-10-13T19:29:52 +1ms service=provider providerID=ollama modelID=qwen3-coder:30b getModel
    INFO  2025-10-13T19:29:52 +0ms service=provider status=started providerID=ollama getSDK
    DEBUG 2025-10-13T19:29:52 +0ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:52 +1ms service=bun pkg=@ai-sdk/openai-compatible version=latest installing package using Bun's default registry resolution
    INFO  2025-10-13T19:29:52 +0ms service=bun cmd=["C:\\Users\\user\\scoop\\apps\\opencode\\0.15.0\\opencode.exe","add","--force","--exact","--cwd","C:\\Users\\user\\.cache\\opencode","@ai-sdk/openai-compatible@latest"] cwd=C:\Users\user\.cache\opencode running
    DEBUG 2025-10-13T19:29:52 +9ms service=tui timeTakenMs=0 messages.renderView
    INFO  2025-10-13T19:29:55 +2817ms service=tui offset=0 x=27 y=46 mouse
    INFO  2025-10-13T19:29:55 +1ms service=tui end=-1,-1 start=27,46 mouse selection
    DEBUG 2025-10-13T19:29:55 +0ms service=tui timeTakenMs=0 messages.renderView
    DEBUG 2025-10-13T19:29:55 +153ms service=tui timeTakenMs=0 messages.renderView
    

    This is an enviroment with an proxy. And http_proxy, https_proxy are set.

    And this is my opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "edit": "ask",
        "bash": "ask"
      },
      "theme": "gruvbox",
      "provider": {
        "ollama": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Ollama",
          "options": {
            "baseURL": "http://10.53.200.243:11434/v1"
          },
          "models": {
            "gpt-oss:20b": {
              "name": "GPT-OSS 20B",
    		  "tools": true,
    		  "options": { "num_ctx": 16384 }
            },
    		"qwen3-coder:30b": {
              "name": "Qwen3-Coder 30B",
    		  "tools": true,
    		  "options": { "num_ctx": 16384 }
            }
          }
        }
      },
      "model": "ollama/qwen3-coder:30b"
    }
    

    @rekram1-node any idea here?

  10. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Contributor

    @somera num_ctx needs to be set in ollama, not opencode,

    I do think this is the equivalent tho:

    And I can set it on start OLLAMA_CONTEXT_LENGTH=16384 OLLAMA_HOST=0.0.0.0 ollama serve.

  11. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Contributor

    not sure what's causing that issue, instead of opencode --log-level DEBUG maybe try:

    opencode run hello --print-logs

  12. traceflight commented on Oct 13, 2025

    @traceflight

    I'm also encountering this issue, but I'm using vllm instead of ollama. Meanwhile, the same model qwen3 coder works fine for tool calling in roo code.

  13. rekram1-node commented on Oct 14, 2025

    @rekram1-node
    Contributor

    @traceflight out of curiousity is it the same model discussed here?
    https://docs.ollama.com/roo-code

  14. traceflight commented on Oct 14, 2025

    @traceflight

    hi, i am using Qwen3-Coder-480B-A35B-Instruct hosted by local vllm instance. it works fine in vscode roo code plugin.

  15. somera commented on Oct 14, 2025

    @somera
    Author

    not sure what's causing that issue, instead of opencode --log-level DEBUG maybe try:

    opencode run hello --print-logs

    In a git bash the test is working. In opencode tui I see than this.

    Image

    In PowehShell it can't communicate with ollama (run on other machine).

  16. somera commented on Oct 14, 2025

    @somera
    Author

    Ok, now I'm running my ollama instance with OLLAMA_CONTEXT_LENGTH=32768 and the tools are running with `qwen3-coder:30b' .

    Image
  17. somera commented on Oct 14, 2025

    @somera
    Author

    I added this to docs but Ig they weren't published yet

    This should help others. I'll go ahead and close this issue since everything is working now. Thanks!

  18. rekram1-node commented on Oct 14, 2025

    @rekram1-node
    Contributor

    awesome!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions