Skip to content

Feat: add appendFile tool - #51

Merged
HoussemEddineChaouch merged 4 commits into
HoussemEddineChaouch:mainfrom
abusnitsky:feat/add-appendfile-tool
Jul 23, 2026
Merged

Feat: add appendFile tool#51
HoussemEddineChaouch merged 4 commits into
HoussemEddineChaouch:mainfrom
abusnitsky:feat/add-appendfile-tool

Conversation

@abusnitsky

@abusnitsky abusnitsky commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a new appendFile tool so the agent can append content to the end of an existing file instead of overwriting it.

This PR includes:

  • New appendFile implementation in functions.js
  • Tool registration so the agent can call it from tools.js
  • System prompt example for appendFile usage in agent.js
  • Available tools documentation update in README.md

Type of change

  • Bug fix
  • New feature / tool
  • Documentation update
  • Refactor

How to test it

  1. Start the CLI agent:

    • Run: node src/index.js
  2. Create a test file with initial content:

    • Prompt: write "hello world" to test.txt
  3. Ask the agent to append content:

    • Prompt: add "hello moon" to test.txt
  4. Verify content was appended, not overwritten:

    • Prompt: show content of test.txt

Related issues

Closes #42

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

@abusnitsky is attempting to deploy a commit to the houssemeddinechaouch's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

👋 Thanks for opening this PR @abusnitsky!

Before we review, please make sure:

  • PR description follows the repo template
  • Your branch is up to date with main
  • You were assigned to the related issue before opening this PR

A maintainer will review it soon. 🙌

@HoussemEddineChaouch

Copy link
Copy Markdown
Owner

Hey @abusnitsky, found a bug before merging

When appendFile is called on a non-existent file the
agent falls back and leaks a raw TOOL JSON string as
the final response instead of executing it:

Agent > TOOL {"name":"writeFile","args":...}-{"Reason":"..."}

Two things to fix:

  1. appendFile should create the file if it doesn't
    exist.

  2. The raw TOOL leak is a separate known bug but
    please make sure appendFile doesn't trigger it
    by handling the missing file case cleanly

Fix those before I merge. Thanks!

@abusnitsky

Copy link
Copy Markdown
Contributor Author

@HoussemEddineChaouch Done. appendFile can now create a new file and doesn't trigger TOOL leak.

@HoussemEddineChaouch
HoussemEddineChaouch merged commit ea3993a into HoussemEddineChaouch:main Jul 23, 2026
1 check failed
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.

[Feature] : add appendFile tool to append content to existing files

2 participants