Ghostwriter is not reporting the correct code at specified lines

I’m trying out Ghostwriter on some fairly simple code. I asked it to explain the code on line 23 of my main.rb file. I was surprised when it explained an entirely different section of the code. Indicating that it had not numbered the code the same way the editor had.

Expected behavior:
I expect Ghostwriter to report the correct code when I ask for it to explain specific lines.

Actual behavior:
I asked Ghostwriter to list out the code it sees in main.rb and it did so correctly. Then I asked it to tell me what code was on a specific line, and it gave me the wrong answer.

Steps to reproduce:
In the replit editor My main.rb file shows as 32 lines of code. But here are some quotes from my chat with Ghostwriter where it got a crazy amount of things wrong.

“How many lines of code are in main.rb?”
"There are 24 lines of code in the file main.rb

I didn’t see how its count could be so drastically off. So I asked Ghostwriter “what code do you see in main.rb” and it printed out the correct code. But I saved the code and rehit “run” anyways.

“What code is in line 16?”
Line 16 in main.rb contains the code "phone.add_contact(‘John’, ‘555-555-5555’)

That’s way off. Line 16 is a blank line (for readability) in my editor.

Summary, tl;dr: Ghostwriter is really broken if its idea of how many lines of code are in a file is so off from what the editor is reporting.

The discrepancy between my line count in the editor and Ghostwriter’s goes well beyond simply not seeing blank lines or comments.

Please let me know if this is user error or a bug and if it is a bug with the Ghostwriter Chat beta then can I please be downgraded to the original Ghostwriter? I right clicked all over my code and could not find the “Explain Code” menu option in any context. That is the feature I would like to use, so please apprise me on how to get one or the other option working.

Bug appears at this link:

Opera browser, Windows 10, Desktop

Hey @lmletham!

Thank you so much for the feedback! I have sent this to the team so we can consider this in our next iteration of Ghostwriter.

Any word yet as to whether this Ghostwriter issue has been fixed? I’d really like to use it, but I am reluctant to pay another $10 to reactivate it just to find out it still can’t number code lines.

1 Like

Hey, thank you for following up!

I understand your concerns about Ghostwriter’s line numbering accuracy. Unfortunately, due to the inherent limitations of AI models, it’s challenging to achieve perfect line number accuracy. We’ve explored various methods internally, but haven’t been able to find a foolproof solution to this issue.

I apologize for the inconvenience caused, and we appreciate your understanding as we continue working to improve Ghostwriter.

1 Like

In general there should be somehow a way to let people get aware that AI is an help to get some ideas but often the code might be wrong (for various reasons) and should not be taken as a gospel.


I’m not unfamiliar with AI at all. Most of these AIs can parse a section of code if you tell them the line. This is a pretty egregious bug. It’s not like I was asking it for something hard. I asked about one specific line and it couldn’t even find that line.